Using Parse JSON to read individual List Records in Flow|Power Automate

This is a scenario I came across when I was using Common Data Service connector [not Common Data Service (Current Environment)] connector to read Opportunities tied to an Account.

Example

In this scenario, I wanted to retrieve the Opportunities tied to an Account. So, my filter query was _parentaccountid_value(‘ACCOUNT_IDENTIFIER’)

Here’s my Flow starts. I want to read Opportunities that are tied to my Account in context –

baseQuery

Flow Inside a solution vs. Outside a Solution

Inside a Solution

Now, when I had this Flow inside a solution, the result didn’t have a body and instead just gave me Status Reason value as below –

missingData

Outside a Solution

Whereas, outside the Solution, I was able to get the array of Objects i.e. Opportunity data in the Body in the Output itself.
outsideSolutionResult

So, what can we do about the Flow which is used inside a Solution and you want to actually see what was the output? You may or may not require to see the records (depending on your implementation)

But let’s say you want to see what was returned, let’s just parse these results as is using Parse JSON to see what we got.

Use Parse JSON from Data Operation

Another way to read what you’re retrieving is using Parse JSON Data Operation.

  1. Search Parse JSON and you’ll see the result in Data Operation type of Actions as shown below –useParseJSON
  2. Now, you have to apply this to Current item from the retrieved List records in Apply to each operation. In case you don’t have the schema or not sure what to put it in. Simply use {} in Schema field. This will just pass through as is.
    applyParseJSON

Checking Result

Now, let’s test using the above and see if we can get the results

  1. Now, you can actually see the Inputs and Output of Parse JSON which is basically the same. This is useful if you want to visually see what’s going on through your Flow.
    visibleResult

But, if you don’t want to see what’s being passed through when in Production? You can Secure Input/Output in Power Automate Run History

Hope this helps you!!

Enable/Disable the need to Approve Email for Mailboxes in Dynamics 365 CRM CE

This is one of the most useful common scenarios where you have to approach a Global Administrator every time to Approve Emails. Even when you want to create a few Queues or test Mailboxes on a non-production environment.

I would recommend this to be used only on Sandbox instance and let Production instance have this layer of approval of Global Administrators, but then it depends what you want to have. 🙂

 

Approve Email

Every time, you want to enable a mailbox for Server Side Synchronization, you are asked to Approve Email.
(If you want to enable Server Side Sync for enabling D365 App For Outlook, check this post Summarizing D365 App For Outlook Setup in 3 steps with Exchange Online mailbox)

emailWontProcess

And even if you try to Test & Enable the mailbox, you’ll see the error as This mailbox is disabled for email processing.
tryTest

And you get the error as IncomingEmailS2SApprovalNeeded. Let’s look at how even System Administrators who aren’t Global Admins can enable Mailboxes.

 

 

Disable Approve Email for Mailboxes & Queues

So, if you want to not have each mailbox need an Approval from Global Administrator, go to Settings in site map > Administration > System Settings > Email tab
settingsArea
In the above screenshot, you select which of the mailboxes or queues or both, you want to allow to process emails without approval. Now, I want to only disable the need for approval for Queues and keep the users as is.
disableForQueue

But doing so myself, gives me the following error
cantDisable

That’s because, to disable this, you’ll need a Global Administrator once. Once they disable this, if you have the appropriate rights to Test & Enable Mailbox, you can directly Test & Enable a mailbox even though the error message is still displayed on the Mailbox after disabling this feature.
success
The mailbox for the Queue is now active.

In case you are also looking to create a Support Queue for your organization, you can check this post Create a support Queue in D365 CE.

Hope this helps!!

Make HTTP request from Flow in Power Automate

One of the most common asks I’ve come across lately is people asking whether or not, we can make external HTTP requests using Flow in Power Automate. Well, yes! Let’s quickly take a look at how you can do that.

Scenario

To keep the example really simple, I have an API that I can use to call to get weather information. (By the way, you’ll find MSN Weather connector in Power Automate too)
So, the API I’m using to test the call is OpenWeatherMap. Their API is really easy to understand for this example.

Note: You can create your account here and you’ll get an API key which you can use.

  1. Now, Let’s say I have the API key and I’m ready to consume their API.
    You can have your Flow start any which way you want, I’m just running it on schedule –
    Select HTTP in the search and select the HTTP trigger
    selectAction
  2. Now, I can fill in the data required to make the HTTP call. In my example, the API is expecting Query String, so I’m passing the values in Queries as needed. It could be different in your case.
    I’m select GET method since we are trying to retrieve data by calling the API
    getSelected

    And then go on to write the rest of the request.
    sampleRequest
    Let’s say, if you’re required to pass headers to a POST request with Body, you can do that as well.

  3. And I’m capturing the response in a variable in Flow to further use it. I’ve chosen to store it in an Object type of variable.
    captureResponseEasy!

Making HTTP Request

Now, let’s test it. I made a sample request and I’ve received the response as below –
I’ll open my response part –
openResponse

Check this, in case you want to also secure the data your receive – Secure Input/Output in Power Automate Run History

And I’ve received the data successfully! Hope this gets you started in making HTTP calls.

Pass data to HTML Web Resource using browser’s sessionStorage in Dynamics 365 CE

If you’re using Xrm.Navigation.openWebResource(webResourceName, windowOptions, data), you probably are already using ‘data’ to the HTML Web Resource you are opening.

Here, I’m using an alternate method. I use JSON to send my data since it is widely preferred and used. Basically, I’ll Stringify my JSON object and add it to session storage, then – retrieve it from sessionStorage and Parse is back to object.

 

Opening Web Resource

Now, in my example, I’m not passing my data in the ‘data’ parameter provided by Xrm.Navigation.openWebResource(), instead I’m putting it in JSON.

  1. Let’s say, somewhere in my code, I want to send out a JSON to the HTML Web Resource which will open in a new window.
    So, instead of passing ‘data’ to Xrm.Navigation.openWebResource(), I’ll simply do the following –
    First, create a JSON object of what I want to send as data.
    Then, I’ll use sessionStorage.setItem(“<key>”, JSONObject); to add it to the sessionStorage and then open the WebResource using Xrm.Navigation.openWebResource()
    storedInSession

Reading from Session Storage

Reading from sessionStorage is as easy as putting data into it. Just the reverse –

  1. Assuming you are familiar with HTML and JS references, make sure you have correctly referenced the JS file you want to use with your HTML. Provide the name of the Web Resource in which you have your JS code.
    fileReferrenced
  2. Once the HTML document is loaded (I prefer using JQuery here to put things into document), you can read the same using sessionStorage.getItem(“<Key>”);

    And then, JSON.parse() the object retrieved from sessionStorage.
    retrived

  3. Also, if you look at the Application tab in Dev Tools of your browser, you can check for Session Storage info.
    You’ll find the Item you stored to the session
    inApplication

That way, you can use sessionStorage to keep your data in the browser session if you don’t have any other concerns or reasons not to use sessionStorage.

 

Hope this helps!!

Retrieve only active Dynamics 365 CE licensed Users in CDS connector in Power Automate

Let’s say you have a requirement where you want to work only on Dynamics 365 and you are using Office 365 Get User Profile action to retrieve all users.

In this example, I have some Dynamics 365 Customer Engagement licenses assigned to uers. And I want to retrieve only the Active D365 Users in my Common Data Service Connector.

Here’s how I do it –

Retrieve Users with Filter Condition

Now, the best thing you could do is identify what is the userlicensetype field of other Dynamics 365 users you might have retrieved in your previous executions.

licenseTypeFilter

I’ve used the query userlicensetype eq 6 to query for Active D365 users

If you want to retrieve Users who have been Disabled, you can check by using userlicensetype eq -1

Note: You’ll need to check the respective values for other users who have licenses like Team Member or Sales Professional. Since I haven’t tried those, I don’t have their exact number codes. Best way is to identify a user whose licence configuration you are looking for and look for their userlicensetype field value in Flow.

Result

This gave me only those users who have D365 Customer Engagement License assigned to them
4retrieved

And if I look at my O365 Portal, I can see that 4 users have the Dynamics 365 Customer Engagement License
D365Licensed

There are even more ways you can use to identify for different licenses used. I recommend it’s good practice to retrieved only those users which are needed for your operation.

If you’re also looking to secure the Input/Output data in Flow, refer this Secure Input/Output in Power Automate Run History

Hope this helps!

Refresh button missing on Roll-Up fields in D365 UCI? Quick Tip.

As we are transitioning to the Unified Interface, some visual cues are a little misplaced or say, hidden.

If your Roll-up field on the Classic UI appeared like this where you could simply click on refresh and update the Roll-up field

classicRefresh

It doesn’t seem to be the case in terms of UCI-
missinginUCI

It’s Hidden!

So, simply click on the Calculator icon –
clickToReveal
And the Recalculate button will be revealed which updates the value
recalculate
And results into the below in my case –
updated
Note: Toggling the calculator icon will reveal/hide the button.

Hope this quick tip helps!!

 

AutoNumber field in CDS | PowerApps

The most desired feature is ability to create/customize your own auto-number field. ANd CDS let’s your do just that!

I remember the good old days when I had to write a plugin to function for AutoNumber which used to configuration from a supposedly separate Configuration entity and it scary to maintain the code and entity. But this solves all that with so much ease!
allRecords

 

Create an AutoNumber field in CDS

  1. Now, you can start by creating a field in CDS’ Solutions > [YourSolution]> [YourEntity]
    createNew

  2. Then, under Accounts, you can see that you can actually create an Autonumber. This is not available in Classic UI.
    Also, please note that you’ll need to keep this field Not Required and Locked (on the form) in order to function.
    underTextGroup
  3. Give it  a suitable name and then you have 3 options to format your auto-number field.
    2TypesOfAutonumber

    String Prefixed number

    You’ll need to define the Prefix, Min Digits, Seed value
    preview

    Date prefixed number

    With Date prefixed, you’ll need to define Date Format, Min Digits of Seed Value
    dateFieldPreview

    Custom

    With custom, you can define the Format. Refer Microsoft’s Documentation for the same – AutoNumberFormat options
    customPreview

Save and Publish as you usually would and place your field on the form you want.

Working

I used String method to design my AutoNumber field. Let’s see how it looks –
Once I save the record, the Auto-number will be filled in.
fieldWorking

If you happen to delete any records already created in the sequence, the auto-number functionality will continue counting upward and not fill out previous backlogs/last deleted auto-number records.

 

Hope this helps!