Primary Key of Activity type entity in a Dataverse connector in Power Automate | Quick Tip

In case it’s your first time creating a Cloud Flow using Dataverse connector and dealing with Primary Key of the Activity Type of entity, here’s a quick tip to keep in mind.

Normal Entity

As a creator for Flow, let’s say you have listed Records of an entity called as Accounts (out-of-the-box), you’ll notice that the name of the entity

Activity Entity

Now, if you try to search for the Name of the Activity entity, it won’t appear as it does for other entities, instead just search “Unique” and you’ll find an entry for Unique identifier of the activity entity –

  1. Name of my Activity entity is ‘Snapshot’, but it doesn’t show up when I search Snapshot.

  2. So instead, just search “Unique” or “Identifier”

  3. On the contrary, out-of-the-box entities have their own names named as Primary Keys

Here are some more Power Automate / Cloud Flow blogs you might want to check –

  1. Split On in Power Automate in SharePoint trigger for Item updates
  2. Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate
  3. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  4. Invalid XML issue in Dataverse connector for List Rows action | Fetch XML Query | Power Automate
  5. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  6. Invalid type. Expected Integer but got Number error in Parse JSON – Error at runtime after generating Schema | Power Automate
  7. Asynchronous HTTP Response from a Flow | Power Automate
  8. Converting JSON to XML and XML to JSON in a Flow | Power Automate
  9. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  10. Tag a User in a Microsoft Teams post made using Power Automate

    Thank you!
Advertisement

Invalid XML issue in Dataverse connector for List Rows action | Fetch XML Query | Power Automate

While using Dataverse connector [formerly known as Common Data Service (Current Environment) connector] for different operations, List Rows is one of the common Actions we use in Flow implementations with Dataverse.

If using FetchXML Query as filter is your choice, there one of the most common issues with an XML is having an Invalid XML due to the special characters in the data we are passing.
Many times, this issue goes unidentified since we end up checking only syntax!

Here’s what you can also add as an additional check to escape the special character scenario in FetchXML query in a List Rows action.

Invalid XML Issue – Special Character

Let’s look at one of the common examples where you’ll see this error on runtime when a FetchXML issue appears

  1. You have a Flow wherein you are using FetchXML query to list records in Dataverse connector using List Records action.


  2. But when happens is, when this Flow Runs, it results in an error on the List Records step.


  3. And if you look at the right hand pane for the error, it could be a Invalid XML error which you would get in Dataverse (or while working in Dynamics CRM if you have experienced in the past).


  4. So, let’s look at what could be wrong in this case among several other reason of using FetchXML and getting syntactical errors.
    If you look at my XML below, it looks like there could be some parameters that have special characters in them and hence, your XML might fail if not anything else.


    Let’s look at how we can resolve the same.

encodeURIComponent() function

As a solution to this, you can use the encodeURIComponent function in Flow to counter this problem –

  1. Now, in ideal cases, you parameters could be coming in from elsewhere which you would add in the FetchXML as parameters.
    Let me store the same in a sample String Variable for now.


    In the Value, I’ll look for an expression called as encodeUriComponent()



  2. Then, I simply enter the value which I’ll pass on to the Fetch XML filter to be used later on. And then I enter the value in the function.


    And it looks like this in your variable.


  3. Now, you just pass this on to the Fetch XML itself.

  4. And now, this should work successfully

Here’ is the Microsoft Docs of the function to encore URI and help streamline special characters – https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#encodeUriComponent?WT.mc_id=DX-MVP-5003911

Hope this was helpful!

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

  1. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  2. Invalid type. Expected Integer but got Number error in Parse JSON – Error at runtime after generating Schema | Power Automate
  3. Asynchronous HTTP Response from a Flow | Power Automate
  4. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  5. Converting JSON to XML and XML to JSON in a Flow | Power Automate
  6. Office 365 Outlook connector in Cloud Flows showing Invalid Connection error | Power Automate
  7. FormatDateTime function in a Flow | Power Automate
  8. Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
  9. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  10. InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip

Thanks!!

Invalid type. Expected Integer but got Number error in Parse JSON – Error at runtime after generating Schema | Power Automate

If you are using JSON Parse function in Power Automate and are comfortably generating schema from Trigger Outputs (or any Output for that matter), to get the Dynamic Content but end up getting the below error even after generating the Schema by parsing actual data itself?

Let’s look at why this happens.

Scenario / Issue

Now, below is the usual step you follow to generate the schema –

  1. Let’s assume you are reading from the body of the CDS trigger. Again, it could be anything. And you are using Parse JSON and generating schema as below –


  2. And the schema is generated as below –

  3. I’ll point out an exception here. The above Schema was generated from a Schema whose data in decimal had 0.0

  4. Hence, when you generated the Schema from the Data, the Data’s Type was set to “integer



  5. So, when 0.0 passes through the parse, it’s successful because it is interpreted as 0 and not 0.0
  6. Now, when something like 2.5 passes through it, it gives the below error.



Solution

  1. Since you can’t be always aware that the data you are using for parsing is an actual Decimal or a Whole Number, so in that case, simply change the Type of the Schema in JSON Parse change to “number

  2. Now, in this case, if you resubmit the same Run again, it will pass through in case there are no other issues.

Hope this helps!!

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

  1. Asynchronous HTTP Response from a Flow | Power Automate
  2. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  3. Tag a User in a Microsoft Teams post made using Power Automate
  4. Converting JSON to XML and XML to JSON in a Flow | Power Automate
  5. Office 365 Outlook connector in Cloud Flows showing Invalid Connection error | Power Automate
  6. FormatDateTime function in a Flow | Power Automate
  7. Formatting Approvals’ Details in Cloud Flows | Power Automate
  8. Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
  9. Create a Team, add Members in Microsoft Teams upon Project and Team Members creation in PSA / Project Operations | Power Automate
  10. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  11. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
  12. Adaptive Cards for Outlook Actionable Messages using Power Automate | Power Platform

Thank you!!

Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate

In a Cloud Flow, if you are using an HTTP Request Trigger that accepts HTTP Requests – you have the option to validate the Incoming data based on the Schema of the JSON.

Scenario

Let’s assume this is the data which will be passed to the HTTP Request Flow –



HTTP Request & Schema

Let’s look at the HTTP Request Trigger itself in a Cloud Flow –

  1. First, let’s initiate the HTTP Request Trigger here and make sure we generate the Schema from the same data we will be passing. I also have a separate post on the HTTP Request itself which you can check here – Accept HTTP Requests in a Flow and send Response back | Power Automate
     
  2. Here, we can paste the sample data which we saw in the scenario above.

  3.  Once you click Done, the Schema will be generated from the sample data you’ve just entered. Additionally, if needed you can also specify the method you are looking to implement. POST in this case


  4. Further on, I’m doing some operations internally and finally, I’ll be sending a response to the caller using the HTTP Response Action in HTTP connector in a Cloud Flow

  5. And here is what I’m sending back in Response if my Flow happens to work as expected.

  6. So, the end of my Flow looks something like this. (Depending on what you are trying to do in your Flow)



     

Turning Validation On

Now, coming back to the HTTP Request trigger itself –

  1. Go to Settings on the HTTP Trigger itself –


  2. Now, look for Schema Validation option and turn it on.


Now, let’s consider the scenario and test the Postman.

Testing with Postman – Validation On

Let’s try to send incorrect data to the Flow using Postman which doesn’t comply with the Schema and see how we receive the 400 Error message in Postman

  1. Now, when I try to send the correct data as expected by the Schema once the validation is turned on, I’ll get a success message once the Flow has finished running and return with a 200 code


  2. Now, if we try to send incorrect data, it will not be accepted. So first, I’ll add a new attribute which I’ve not added in the schema already in order for the validation to fail and give us an expected validation error.
    See the data which I’m sending. To which, I get the 400 Bad Request error

  3. If you get back a 400 Bad Request, the Flow will not register it as a Flow Run. Hence, you won’t know if the Flow was hit or not.
  4. And in case the validation is turned OFF, you’ll get the Response as expected from the Flow in the event that Flow has completed successful execution.

Hope this post helped!

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

  1. Tag a User in a Microsoft Teams post made using Power Automate
  2. Converting JSON to XML and XML to JSON in a Flow | Power Automate
  3. Office 365 Outlook connector in Cloud Flows showing Invalid Connection error | Power Automate
  4. FormatDateTime function in a Flow | Power Automate
  5. Formatting Approvals’ Details in Cloud Flows | Power Automate
  6. Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
  7. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  8. InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
  9. Setting Lookup in a Flow CDS Connector: Classic vs. Current Environment connector | Power Automate Quick Tip
  10. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
  11. Using triggerBody() / triggerOutput() to read CDS trigger metadata attributes in a Flow | Power Automate
  12. Secure Input/Output in Power Automate Run History

Here are som

Converting JSON to XML and XML to JSON in a Flow | Power Automate

In this very simple post, let’s look at how you can convert JSON to XML and XML back to JSON while working in Power Automate.

First, let’s look at converting JSON to XML and then, XML to JSON from the same result of the first conversion.

JSON to XML

Let’s look at an example where we have a sample JSON which we will convert to XML in Power Automate using xml() function and we’ll revert the same operation using xml() function in Power Automate itself.

  1. So starting off with JSON data, you’ll need a String based JSON data. I’ll store the same in a variable which looks like below.

  2. If I format the same data in JSON formatter online, it’ll look like this –


  3. Next, we can use the formula xml(<jsonData>) in the expressions and use it as below

    Now, since I’m storing my JSON data in String already, I’m converting it to JSON by using json() function inside the xml() function.
  4. The result of the same is as below

  5. And if we take it to an XML formatter, it’ll look like below
Let’s look at what won’t work
  1. Cannot use an Array and there can be only 1 Root element. Hence, the below won’t work –
    You cannot have an Array of JSON elements which looks like below –


    It will result in the below error saying, “The template language function ‘xml’ parameter is not valid. The provided value cannot be converted to XML:’Data at the root level is invalid…


  2. Also, when it is not an Array already, but there are Multiple Attributes at the Root level itself, it won’t work either. Something like below –

    Or if we format and look at it, the Name and the Newsletters is the same Root level –

    Which will result in the below error ‘The template language function ‘xml’ parameter is not valid. The provided value cannot be converted to XML: ‘JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document. Consider specifying a DeserializeRootElementName. Path ‘Newsletters’.’

XML to JSON

Similarly, let’s see how we can inverse the conversion now from XML back to JSON –

  1. In this post, we are taking the same XML result which we first converted from JSON back to JSON again. But you can start fresh or take the source from elsewhere, of course.
    The formula to convert from XML to JSON is

    Like in the previous step, the XML was in String as a result captured from the previous step and we need to convert it to XML first in order to convert it to JSON.

  2. The result is as follows –

  3. Also, like in the previous JSON to XML conversion, Root level node has to be present. Else, you’ll see the following error in case you don’t have a root for the XML.


    And it will result in the below error

Official Microsoft Links for the above functions are –

  1. JSON – https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#xml?WT.mc_id=DX-MVP-5003911
  2. XML – https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#json?WT.mc_id=DX-MVP-5003911

Hope this was helpful! Here are some more Power Automate / Flow posts you might want to check –

  1. Office 365 Outlook connector in Cloud Flows showing Invalid Connection error | Power Automate
  2. Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
  3. FormatDateTime function in a Flow | Power Automate
  4. Formatting Approvals’ Details in Cloud Flows | Power Automate
  5. InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
  6. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  7. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
  8. Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
  9. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  10. Run As context in CDS (Current Environment) Flow Trigger | Power Automate

Thanks!!

FormatDateTime function in a Flow | Power Automate

DateTime fields from Dataverse / Common Data Service (Current Environment) are retrieved in full Date and Time format. And in common applications, you are required to only retrieve the Date and not the Time. Or even Format the Date Time in a certain way.

Let’s look at how to format DateTime in a Flow which appears as below

Let’s look at a simple example by trying to format a Created On date field.

FormatDateTime function

  1. Let’s a take a variable of type String to store our formatted Date. Now, in the variable, go for Functions and look for FormatDateTime function.


  2. Now, it asks for 2 parameters – TimeStamp and Format.

  3. Since I’m picking the field from the trigger itself, I’ll use the below formula to pick from triggerBody().

    In case you want to also learn how to use triggerBody(), triggerOutputs() or outputs(), you can refer below posts –
    1. Using triggerBody() / triggerOutput() to read CDS trigger metadata attributes in a Flow | Power Automate
    2. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate

  4. In the second parameter, put the format of the date in single quotations as shown below –


    You can follow this official Microsoft documentation – https://docs.microsoft.com/en-gb/dotnet/standard/base-types/custom-date-and-time-format-strings?WT.mc_id=DX-MVP-5003911

  5. And your Date Format is set. When you run the Flow, you’ll get the formatted date.


    Hope this was quick and helpful!

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

  1. Formatting Approvals’ Details in Cloud Flows | Power Automate
  2. Number Formatting in a Flow | Power Automate
  3. Parallel Branching in Cloud Flows – Isolate Response dependent Step Actions in parallel branches | Quick Tip
  4. Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
  5. InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
  6. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  7. Run As context in CDS (Current Environment) Flow Trigger | Power Automate
  8. Setting Lookup in a Flow CDS Connector: Classic vs. Current Environment connector | Power Automate Quick Tip
  9. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  10. Task Completion reminder using Flow Bot in Microsoft Teams | Power Automate

Thank you!!

Formatting Approvals’ Details in Cloud Flows | Power Automate

Now, not always Approvals details/description should appear as plain text. In order to enrich the Details of an Approval Adaptive Cards (which you can send as part of standard Approvals provided by Cloud Flows / Power Automate)
In this post, I’ll be looking at an example to format Details for a “Start and wait for an approval” Action step in Power Automate / Cloud Flow


You can enrich the Details so that they appear easy to read and are more meaningful.

Scenario

Let’s say I receive the below Approval with the Details mentioned as below.

And the Details section as you see appears bland without formatting. Let’s format the same using some Markdown examples.

Markdown Support for Details in Approvals in Cloud Flows

  1. If you select Approvals and notice the Details field, you’ll see a watermark saying that Markdown is supported.

  2. Markdown is a light-weight markup language for formatted text. MS Docs Official Link for all Markdown usage: https://docs.microsoft.com/en-us/power-automate/approvals-markdown-support?WT.mc_id=DX-MVP-5003911
  3. Let’s look at how the below plain text can be enriched using Markdown

  4. Now, understanding how Markdown is used from the documentation provided above, you can format the details as below –

  5. And the formatted Details section looks more meaningful and appealing.

Hope this helps!

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

  1. Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
  2. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  3. Parallel Branching in Cloud Flows – Isolate Response dependent Step Actions in parallel branches | Quick Tip
  4. InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
  5. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
  6. Create a Team, add Members in Microsoft Teams upon Project and Team Members creation in PSA / Project Operations | Power Automate
  7. Adaptive Cards for Outlook Actionable Messages using Power Automate | Power Platform
  8. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  9. Run As context in CDS (Current Environment) Flow Trigger | Power Automate
  10. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate

Thank you !!

Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip

At times, you’re pretty sure that the trigger condition you’ve put in a Cloud Flow is correct but it still doesn’t trigger.

Scenario

Here’s a scenario which I came across where the Trigger Conditions weren’t triggering. The trigger was Common Data Service (Current Environment) connector and the Trigger Conditions were supposed to check for a specific value to fire.

However, even upon fulfilling the criteria, the Flow was not firing.

Here’s why

Let’s look at what happened here –

  1. Now, as expected the Flow should have triggered when my field Account Type has Option Set value of 3 i.e. “Partner”(on the label)

  2. The reason was that the Filtering Attribute too was added in the Trigger which clashed.

  3. And this was a clash between the two. Hence, the Condition Trigger was not fired.
  4. On the other hand, if the field which is in the Filtering Attributes was changed, the Flow was triggered.

Takeaway

So here are the takeaways –

  1. Trigger Conditions won’t fire even if the condition is matched because there’s a Filtering Attribute added to an Update trigger on the Common Data Service (Current Environment) connector.
  2. Even if Trigger Condition exists, the Filtering Attributes takes higher precedence and hence, an update on the Filtering Attributes will trigger rather than Trigger Conditions.

Hope this helps!

Here are some more Power Automate / Cloud Flows posts you might want to check –

  1. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  2. InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
  3. Create a Team, add Members in Microsoft Teams upon Project and Team Members creation in PSA / Project Operations | Power Automate
  4. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
  5. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  6. Run As context in CDS (Current Environment) Flow Trigger | Power Automate
  7. Adaptive Cards for Outlook Actionable Messages using Power Automate | Power Platform
  8. Task Completion reminder using Flow Bot in Microsoft Teams | Power Automate
  9. Using triggerBody() / triggerOutput() to read CDS trigger metadata attributes in a Flow | Power Automate
  10. Terminate a Flow with Failed/Cancelled status | Power Automate

Thank you!!

Parallel Branching in Cloud Flows – Isolate Response dependent Step Actions in parallel branches | Quick Tip

As 2020 comes to a close, here’s a Power Automate / Cloud Flows quick tip that might benefit newbies to Power Automate.

Scenario

Some Flows need you to include Approvals or Adaptive Cards that halt the execution of the Flow until the Response from the target is sent back to the Flow.

If there are some steps to be taken after the Response is received.

Parallel Branching

You can use Parallel Branching

  1. Select Parallel Branching instead of a normal Step.

  2. Now, all the Response dependent Actions should be in one of the Branches – (Denoted by Red Box and arrow). And the other part where the execution is expected to be carried forward should be in the other branch – (Denoted by Green Box and arrow)




  3. The execution will then wait where the parallel branches merge finally. Else, each branch can choose to end independently if there are no inter-dependent actions to be take, like taking Response from the Parallel Branch as well. The Waiting state will look like this –


  4. Now, when the Response is submitted back, the Flow execution will continue from the point of convergence of the two parallelly separated branches.

With this, you can separate dependent activities by using Parallel Branching.

Hope this was useful!

Here are some more Power Automate / Cloud Flows posts that you might like to go through –

  1. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  2. InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
  3. Create a Team, add Members in Microsoft Teams upon Project and Team Members creation in PSA / Project Operations | Power Automate
  4. Setting Lookup in a Flow CDS Connector: Classic vs. Current Environment connector | Power Automate Quick Tip
  5. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
  6. Adaptive Cards for Outlook Actionable Messages using Power Automate | Power Platform
  7. Task Completion reminder using Flow Bot in Microsoft Teams | Power Automate
  8. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  9. Using triggerBody() / triggerOutput() to read CDS trigger metadata attributes in a Flow | Power Automate
  10. Adaptive Cards for Teams to collect data from users using Power Automate | SharePoint Lists

Thank you!!

Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate

Retrieving OptionSet Labels from CDS data in a Cloud Flow / Power Automate / Flow is an extra step than just picking from the Dynamic Values. Check this post!!

Scenario

While working with data that is either a result of a Dataverse Trigger (on Create/Update) or Action like (Get record, list record), the OptionSet fields from CDS/Dataverse return the Values of the OptionSet instead of the Text Labels –

  1. Let’s say this is the OptionSet in Dynamics

  2. And when you pick the OptionSet field from CDS either from an Action or a Trigger like this
    Let’s say I’m capturing this in a variable to show you


    I’m storing this in a variable for this example to show you

  3. I’ll capture the Value of the OptionSet i.e. the Value part


    Result –

  4. What needs to be displayed is the Label of the OptionSet! Let’s see how we can do this –
    1. Triggers
    2. Actions – List records (Inside Loops)
    3. Actions – Get record (Single record)

triggerOutputs() / triggerBody() to read the OptionSet values from Triggers

Let’s see how to read the OptionSet values from CDS Triggers, Create or Update –

  1. When a Flow is triggered using CDS/Dataverse Triggers (I’m using Common Data Service Environment(Current Environment) trigger), you can read the OptionSet value by using triggerOutputs() / triggerBody() function –
    Here’s a triggerBody() example

    Now, notice that the name of the field is cf_accounttype. So, the label in Triggers can be retrieved as _cf_accounttype_label and NOT cf_accounttype.

    Same way, you can also use triggerBody() function instead as well to yield the same result


    Here’s a post on triggerBody() / triggerOutputs() for your reference – Using triggerBody() / triggerOutput() to read CDS trigger metadata attributes in a Flow | Power Automate

items() to read the OptionSet values from Action Step – List Records (Multiple Records)

Let’s look at this example where you are retrieving multiple records using List Records and now, you apply a loop on each of those to read individual records.

  1. Assuming you are using List Records and you loop through the outputs of each of these records


  2. Now, the value is represented by items() function on the Loop that you are in i.e. Apply to each.
    Hence, the function is
    items('Apply_to_each')?['cf_accounttype@OData.Community.Display.V1.FormattedValue']


    This will show the label of the OptionSet in the results


outputs() to read the OptionSet values from Action Step – Get a record (Single Record)

Similar to items() function, we can use outputs() function to read from the Output’s of the Get a Record Action from Common Data Service (Current Environment)

  1. Get an Account is a ‘Get a record’ Action in CDS/Dataverse Current Environment connector. It’ll only fetch a single record.

  2. Now, let’s look at how outputs() function, similar to items() function used in case of Loops is used.
    Formula is –
    outputs('Get_an_Account')?['body/cf_accounttype@OData.Community.Display.V1.FormattedValue']

    In the above scenario, I’m reading under body hierarchy for cf_accounttype@OData.Community.Display.V1.FormattedValue

Using JSON Parse to get the values

Finally, there’s also a method in which you can create a Parsed JSON from the Outputs

  1. Pick JSON from the Actions, it is under Data Operations connector and is a very popular one.

  2. Now, you’ll need to pass Outputs of the CDS Step to the Inputs of the Parse JSON step. Now, since you don’t already have a schema yet, Just put {} and save (else, you won’t be able to save)

  3. Now, Run the Flow once where the CDS step was successful and copy the Outputs from the Body

  4. Now, go to the same Parse JSON Step and click on Generate from Sample

  5. Now, paste the copied Body to generate the schema.

  6. Once you click OK, the schema will be generated.


  7. Finally, you can select the Parsed schema and use it as Outputs.


    And it will appear as below –


    Again, this will also show the same results as the above approaches.

Hope this helps!

Here are some Power Automate / Cloud Flow posts you might find helpful –

  1. InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
  2. Create a Team, add Members in Microsoft Teams upon Project and Team Members creation in PSA / Project Operations | Power Automate
  3. Setting Lookup in a Flow CDS Connector: Classic vs. Current Environment connector | Power Automate Quick Tip
  4. Adaptive Cards for Outlook Actionable Messages using Power Automate | Power Platform
  5. ChildFlowUnsupportedForInvokerConnections error while using Child Flows [SOLVED] | Power Automate
  6. Run As context in CDS (Current Environment) Flow Trigger | Power Automate
  7. Using outputs() function and JSON Parse to read data from missing dynamic value in a Flow | Power Automate
  8. Setting Retry Policy for an HTTP request in a Flow | Power Automate
  9. Make On-Demand Flow to show up in Dynamics 365 | Power Automate
  10. Task Completion reminder using Flow Bot in Microsoft Teams | Power Automate
  11. BPF Flow Step as a Trigger in CDS (Current Environment) connector | Power Automate
  12. Pause a Flow using Delay and Delay Until | Power Automate

Thank you!!