Dynamic content behavior for Get a row by ID and List Rows action in Dataverse connector | Power Automate Flow

Here’s an observation in one of the actions in the Dataverse connectors in Power Automate, which is “Get a row by ID”.

Select Columns

If you have selected specific columns in the Select Columns parameter of the connector, only those will be shown in the Dynamic content in next steps of the Flow.

All Columns

When you have not mentioned/selected specific columns and kept it blank, you’ll see the complete list of fields in the next steps of the Flow.

List Rows action

The same is also true for other action like “List Records” which shows all the attributes when selected columns are not mentioned, but shows only the ones mentioned with other required attributes if you have specific column names entered as shown below.

Hope this was useful!

Here are some Power Automate posts you want to check out –

  1. Select the item based on a key value using Filter Array in Power Automate
  2. Select values from an array using Select action in a Power Automate Flow
  3. Blocking Attachment Extensions in Dynamics 365 CRM
  4. Upgrade Dataverse for Teams Environment to Dataverse Environment
  5. Showing Sandbox or Non Production Apps in Power App mobile app
  6. Create a Power Apps Per User Plan Trial | Dataverse environment
  7. Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
  8. Co-presence in Power Automate | Multiple users working on a Flow
  9. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  10. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  11. Call a Flow from Canvas Power App and get back response | Power Platform\
  12. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  13. Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
  14. Asynchronous HTTP Response from a Flow | Power Automate
  15. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  16. Converting JSON to XML and XML to JSON in a Flow | Power Automate

Thank you!

Advertisement

Try Catch error handling using Scope in Power Automate

As a programmer, using Try-Catch is a common programming practice to handle exceptions. Now, since we’ve moved more towards low-code platform implementations, error handling here is a must as well.

Generally, if a Flow fails as per below, we should be able to handle the exceptions effectively –


And this is what happened to my action step –

And this Flow will end in Failed Run status. So let’s ensure we handle this in a simple way.

Group actions using Scope

First step is to club the actions into a group which can be accomplished by an action called Scope. This will give us controls as to what happens if this Scope fails, succeeds, times out or is skipped –

  1. Search for Scope in the Flow and add it.

  2. Now, add the actions which needs to be handled for Exceptions in the Scope you just added.

  3. And it should looks like this – Also, consider renaming the Scope as you might want to handle each section of the Flow differently for different potential actions


    Here, your Try block is ready.
  4. Now, let’s design the Catch block. Add one more Scope to the Flow (Ideally, after the Try Scope we just added)

  5. For example, you can add an email step to notify the developer, typically.



Configure Run After

Now, let’s configure the Run After on the ‘Catch SP Exceptions‘ scope we added in the step above

  1. Now, go to the ellipses on the Catch scope we just created.
    You’ll find Configure Run After. This defines that when should this selected Scope Run based on the results of the previous Scopes.

  2. And you can select the criteria you are defining for the ‘Try – SharePoint Actions’ scope’s results.
    The below implies that run ‘Catch SP Exceptions’ block after the ‘Try – SharePoint Actions’ block failed (or any action in it fails)

  3. And at this point, you are done. You can see a little i icon to see what is configured.
    The arrow connecting the steps are also different (in brown as compared to other black/dark gray arrows.)

Testing

Now, let’s test this simple scenario and see how the executions will take place in terms of error.

  1. We’ll resubmit the same failed Run to now go through these Scopes and observe our course of action.
    As you see below, Try – SharePoint Actions scope has failed as expected but because we had configured the Catch SP Exceptions to Run After the Try – SharePoint Actions failed.
    And note that the End Result of the Flow is also a Success.

  2. Now, let’s see what happens if the Exception doesn’t occur and it succeeds.
    But, notice that even the steps after the Catch SP Exceptions didn’t execute.
    Now, I’ll explain below why that happened.

  3. This happened because Catch SP Exceptions itself didn’t execute and the Delay step is connected to Catch SP Exceptions steps by default.
    Now, you’ll need to also configure the Delay Step to Run After the Try – SharePoint Actions is Skipped executed. Then, the Flow will continue it’s normal execution that point on.

  4. And if you Run this again, since the Catch SP Exceptions is Skipped, the Delay will continue to Run.
    And everything after that. See another step added to validate this.

Hope this was quick and easy to understand.

Here are some more Dynamics 365 posts which you might be interested in –

  1. Enable SharePoint Online integration Dynamics 365 | Power Platform Admin Center
  2. Dynamics 365 Storage Utilization | Dataverse Storage | Power Platform Admin Center
  3. Use Hierarchy in Roll Up Fields in Dynamics 365 CRM
  4. Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
  5. Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
  6. Dynamics 365 App For Outlook missing on SiteMap in CRM? Use shortcut link [Quick Tip]
  7. Import lookup referencing records together in Dynamics 365 CRM | [Linking related entity data during Excel Import]
  8. Excel Importing Notes (Annotation) entity in Dynamics 365 CRM
  9. Enable/Disable the need to Approve Email for Mailboxes in Dynamics 365 CRM CE
  10. Call Azure Function from Dynamics 365 CRM using Webhooks
  11. Show Ribbon button only on record selection in Dynamics CRM
  12. Accessing multiple occurrences of a field in Business Process Flow using JS in D365 CRM

Thank you!!

Call Flow from Webhooks in Dynamics 365 CRM | Power Automate

In case you are wondering if there are other ways to call a Flow apart from just Dataverse connectors, well – There are ways! 😊

Here’s how you can use Webhooks registered on Dynamics 365 CRM to call a Flow in Power Automate using HTTP Request trigger

Pre-Requisites

Given that you already have Admin Access to create Flows with HTTP Request Triggers, you’ll need to have Plugin Registration Tool in case you are not familiar – Download Plugin Registration Tool for Dynamics 365 CRM using PowerShell

Initiate a Flow

Here’s how you start building your Flow –

  1. You must select the HTTP Trigger when you start a new flow. This will be your Flow trigger.

  2. Now, in order to be able to get the URL of the HTTP Trigger which you’ll need, you’ll need to save the Flow first.
    And for that, Flow needs to have more than 1 step. So just go ahead and add a variable, maybe. 😊

  3. Once you save the Flow, the URL will be generated which you can copy

  4. Copy this URL and paste it in the Notepad. We’ll come to it later.
    It should look like this –

    So we’ll come to this later. Let’s keep this handy in clipboard since you’ve copied it anyway and let’s move towards registering the Webhook itself.

Register Webhook in Dynamics 365 CRM

Given that you have Plugin Registration Tool and you are logged in, you can proceed with registering a Webhook in the environment –

  1. In the menu, select Register a Webhook option.

  2. Now, you can start by giving it a name.
    Then, in Endpoint URL – copy only till the work invoke
    https://prod-131.westus.logic.azure.com:443/workflows/6092c774224e498ebe413f3d7c05a45e/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gvfm52Mpnhsz4Ew4ufRllNM_VhfC6a-GkCpM7AigPU0

    Also, select the Authentication as HttpQueryString

  3. Now, coming the next part, you can start add properties to this –
    Green are the Properties, Pink are the Values

    https://prod-131.westus.logic.azure.com:443/workflows/6092c774224e498ebe413f3d7c05a45e/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=gvfm52Mpnhsz4Ew4ufRllNM_VhfC6a-GkCpM7AigPU0

    Also, in case you are wondering what does the %2F mean – It’s the HTML encoding for a slash symbol “/
    Ref Link: https://www.w3schools.com/tags/ref_urlencode.ASP

    And, the properties should look like below –


  4. Now, you can go ahead and add a Step just like you would do in a Plugin assembly


    And then, for example, register a step on Associate. It could be any message.

  5. And, when you Associate a record, example – Assigning a security role to a User –

  6. The Webhook will call the HTTP Request Flow


    And if you open the Flow, you can expand the first step and see the Detailed outputs






  7. You can copy the above Outputs and use this to generate Schema for the HTTP Trigger so that you can use it further in the Flow


    And this is how it will be generated

Hope this helps!

Here are some Power Automate posts you want to check out –

  1. Showing Sandbox or Non Production Apps in Power App mobile app
  2. Create a Power Apps Per User Plan Trial | Dataverse environment
  3. Install On-Premise Gateway from Power Automate or Power Apps | Power Platform
  4. Co-presence in Power Automate | Multiple users working on a Flow
  5. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  6. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  7. Call a Flow from Canvas Power App and get back response | Power Platform\
  8. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  9. Parsing Outputs of a List Rows action using Parse JSON in a Flow | Common Data Service (CE) connector
  10. Asynchronous HTTP Response from a Flow | Power Automate
  11. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  12. Converting JSON to XML and XML to JSON in a Flow | Power Automate

Thank you!

Join action in Data Operations in Power Automate

One of the commonly used connectors to perform operations in Flow is Data Operations

To describe this action in simpler terms, it is “Joining values in an array with a value”.

Join

Here’s how you can use the Join operation in Power Automate

  1. Look for Data Operations connector in Power Automate.

  2. In Join, you’ll see that you’ll need two fields that takes a source and by what character you want to Join into the String result this Action will output.

  3. Example – I want to Join numbers by a hyphen “-“. Here’s how it can be done.
    Here’s how my From and Join With fields will be populated.

  4. And this will return a String value by joining the items in the array by the value we entered in Join With.


    To be sure this is string, you can click on Show raw outputs and see the results


    Hope this was useful!

Here are some more Power Automate / Flow posts you might want to check out –

  1. Retrieve Metadata of Global OptionSets from Dynamics 365 in Power Automate | HTTP with Azure AD action
  2. Primary Key of Activity type entity in a Dataverse connector in Power Automate | Quick Tip
  3. Split On in Power Automate in SharePoint trigger for Item updates
  4. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  5. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  6. Invalid XML issue in Dataverse connector for List Rows action | Fetch XML Query | Power Automate
  7. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  8. Invalid type. Expected Integer but got Number error in Parse JSON – Error at runtime after generating Schema | Power Automate
  9. Asynchronous HTTP Response from a Flow | Power Automate
  10. Setting Lookup in a Flow CDS Connector: Classic vs. Current Environment connector | Power Automate Quick Tip

Thank you!

Visualize Adaptive Card for Teams user action within a Cloud Flow | Experimental Feature

Microsoft Teams’ connector for Cloud Flows (Power Automate), and if you are looking to use Adaptive Cards for Microsoft Teams from the connector. There are chances that you’ll see some options to post an Adaptive Cards to Teams.

I’m exclusively covering a Teams’ connector’s Action called as Post an Adaptive Card to a Teams user and wait for a response.

But, you also have an improved Adaptive Cards Action in the Microsoft Teams’ connector that let’s you save the progress of the Card in the Flow itself!

Also, I found this effective for only 1 Action from the Microsoft Team’s Adaptive Card related actions. Not others.

Adaptive Card to Teams User – Regular

So, if you see the below –

With the above Adaptive Card, you’ll need to work in https://adaptivecards.io/ and paste the Card payload here and then save it. Also, you can’t visualize it within the Flow step itself.

Turn on Experimental Features for Flow

  1. Look for the Gear icon in Settings and look for All Power Automate Settings


  2. If the Experimental Features show below is turned Off, please turn it on.

Adaptive Card with Experimental Features On

  1. Now, if you select the same Action from the Power Automate step

  2. You’ll see the Step Action having the below details.


  3. Once you click on Create Adaptive Card, you’ll see the Designer itself in the Flow Steps which you can create the Card on the fly within the Flow and save the same as well.


    Hope this helps!!

Here are some more Power Automate posts you might want to look at –

  1. FormatDateTime function in a Flow | Power Automate
  2. Formatting Approvals’ Details in Cloud Flows | Power Automate
  3. Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
  4. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  5. Save Adaptive Cards work using VS Code Extension – Adaptive Cards Studio | Quick Tip
  6. Adaptive Cards for Outlook Actionable Messages using Power Automate | Power Platform
  7. Parallel Branching in Cloud Flows – Isolate Response dependent Step Actions in parallel branches | Quick Tip
  8. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
  9. Using triggerBody() / triggerOutput() to read CDS trigger metadata attributes in a Flow | Power Automate
  10. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate

Thank you!!

Get Count of records retrieved in CDS connector in a Flow | Power Automate

In several applications, you need to know how many record were retrieved in the List records Action in a Common Data Service connector in order to take a decision.

Scenario

Typically, let’s say I know only 1 record should exist in order to take that record forward and do an action. But how do I know when only 1 record was received? That’s when you use Control

Check Count

Now, let’s say you want to want to retrieve Accounts and know how many were returned (Perhaps, you want to proceed only if at least 1 or more were retrieved)

  1. This is my List Records action and I’ve named it as Get All Records.
    defaultListRecords
  2. And just to display how many records are retrieved, I’ll use a variable. Usually, you would use this in condition (which we’ll get to in a bit)
    initVar
  3. So, in the expressions to set the Variable, under Dynamic Content, I’ll write –
    writeHereand write the below expressioncountactualExpression
    which is set to the variable
    setVar
  4. And here are the results. I have 101 Accounts
    count

Using it for comparison

This is one of the typical use cases where you want to proceed only if you have at least 1 record –
typicalUseCase

Here are some more Flow related topics you might want to take a look at –

  1. Number Formatting in a Flow | Power Automate
  2. Get N:N records in a Canvas Power App using Common Data Service connector | Power Platform
  3. Switch-Case in a Flow | Power Automate
  4. Setting Retry Policy for an HTTP request in a Flow | Power Automate
  5. Retrieve only active Dynamics 365 CE licensed Users in CDS connector in Power Automate
  6. Button Flow in Power Automate to replicate a Quick Create Form in D365 CE
  7. Make HTTP request from Flow in Power Automate
  8. Create a To-Do List Item of Important Outlook Emails using Power Automate

Hope this quick tip helps!

Number Formatting in a Flow | Power Automate

Quite obviously this is one of the most common asks in Flow to format a number. Here are some ways to do so using Format number Action in Flow (Power Automate).

This is available in Format number action in a Flow in Power Automate. This is available in Number Functions connector.
numActions

Commas and Decimals

  1. For a standard simple number, you can simply denote by # and commas or other symbols where needed. Here, I won’t select any locale.
    standardNumberBody
  2. And it would render into this –
    standardNumber

Phone Number

  1. US phone is an example where it is denoted by brackets and dashes in between. I’ll select English (United States) (en-US) in the locale among others. So, my format would be.
    isPhoneBody
  2. And the resultant phone number will be set as below
    usPhone

Currency Input

For currency, this is what I did –

  1. Added ₹ followed by ##,###,###. I’ll select English (India) (en-IN) in the Locale field.
    indCurrencyBody
  2. So even though my number value i.e. (50000) is in thousands and not hundred-thousands as I covered in my format, it’ll consider the correct format used and my output will be – indCurrency

Here’s where you can look at other ways to format numbers –
1. Standard numeric format strings
2. Custom numeric format strings

If you’re looking for some more posts on Flow / Power Automate, I’ve written some in the past. Check these –

  1. Create a To-Do List Item of Important Outlook Emails using Power Automate
  2. Get N:N records in a Canvas Power App using Common Data Service connector | Power Platform
  3. Call a Dynamics 365 Action from Flow [Bound and Unbound Actions] | Power Automate
  4. Switch-Case in a Flow | Power Automate
  5. Setting Retry Policy for an HTTP request in a Flow | Power Automate
  6. Make HTTP request from Flow in Power Automate
  7. Using Parse JSON to read individual List Records in Flow|Power Automate
  8. Secure Input/Output in Power Automate Run History
  9. Button Flow in Power Automate to replicate a Quick Create Form in D365 CE
  10. Enable Flow button on D365 Ribbon

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!

Approval Process using Power Automate

Approvals have been around for quite some time now in Power Automate. Let’s look at the simplest example of how we can make use of Approvals in Flow / Power Automate and then you let your imagination and creativity take over!

Scenario

For the sake of simplicity, I have a custom entity called Request where users submit a Request and the Approval simply has to Approve/Reject.
simpleRequestRecord.png

The Approved/Reject status should be set in Dynamics 365 accordingly. Simple!

Power Automate for Approval

And then, my Power Automate looks like this –

  1. I will trigger this off the CDS connector on create of the Request record and then select Approvals in the next step.
    approvalConnector
  2. The Type of Approval selection is asked.
    typeOfApprova
  3. And my Approval body is simple, just providing the basic details and whom the Approval request should go to. In this case, Kuldeep Gupta
    approvalBody.png
  4. In the next Condition step, based on whether the Outcome is Approve or not, I’ll simply update the record’s status to either Accepted or Rejected.
    condition.png
  5. If Yes, the following will execute
    Yes
  6. And if No, then the below
    No

That’s it. Let’s see it in action!

Approval Process

  1. Let’s say Priyesh has created a Request record in Dynamics
    simpleRequestRecord
  2. As I submit this request, an Email from Power Automate goes out to Kuldeep asking for approval. And right on the email itself, he can chose to Accept/Reject
    approvalReceived
  3. Let’s say the request was Accepted
    responseSubmitted.png
  4. The request will be Approved.
    approvedMessage.png
  5. And in Dynamics, the status of the record will be changed to Accepted as defined in the conditions.
    acceptedRecord.png

Hope this quick tutorial helps!

Enable Flow button on D365 Ribbon

This is a pretty simple tweak to either show or hide the Flow button on the entity Forms’ Ribbon.

flowButtonVisible

Flow Button Not Visible

nowFlow

System Settings

Navigate to Settings > Administration. Go to System Settings
systemSettings

In System Settings, under Customization tab, look for Enable Microsoft Flow option.
customizationTab

You’ll be asked for permission
permission.png

Now, this is turned on
turnedOn.png

Flow Button Visible

Now, once you have enabled this setting, you’ll be able to see the Flow button on the View and Form ribbons across Dynamics 365 CE
flowButtonVisible

That was quick!!