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!

Search Rows (preview) Action in Dataverse connector in a Flow | Power Automate

As Dataverse connector keeps getting updated from time to time, here’s a new Search rows (preview) Action which you must be seeing in the Dataverse connector in Power Automate. Let’s see how we can use this Action.

As it suggests, that this is still in preview! So kindly take a note of that.

Search Rows (Preview)

  1. Search rows is an Action in the Dataverse connector and you’ll be able to see it like this

Enable Relevance Search

  1. Let’s assume you went ahead and used this connector in your Flow without having Relevance Search enabled in your D365 CE organization, you’ll see the Search Rows throw the below error.


    And the error is described as –

  2. To make Search Rows work, Relevance Search must be enabled for you Dynamics 365 CE / CRM environment. Head over to the System Settings in Dynamics 365 under Settings > Administration > System Settings. And in General tab, look for Relevance Search option, check-mark it and save.


  3. Here’s the full Microsoft Documentation on how to use queries for Relevance Search – https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/relevance-search?WT.mc_id=DX-MVP-5003911

Using Search Rows action

Let’s see how this Action from the Dataverse connector will work –

  1. Now, once you have selected the Search rows action, below are the features which I’ll explain one by one –

  2. Let’s first look at the last item i.e. Return row count. As it says, will result the count of results returned if set to Yes.
    Will return -1 if set to No.

  3. For Search Type and Search Mode to be covered, these need to be explained extensively since it covers several factors. To keep it short for now, I’ve linked the Search Type and Search Mode documentation as below
    https://docs.microsoft.com/en-us/power-automate/dataverse/search#search-type?WT.mc_id=DX-MVP-5003911

    And the short Summary of the same is:
    Search Type:simple | full” There are 2 types called as simple and full. Default = simple. Both have different functions within them that you can use on the Search Term.

    Search Mode: “any | all” By Default – any. This defines if any criteria of the Search Term is to be considered or all must be true based on different syntax and operators used.
  4. Row Count denotes how many records should the results Return which is standard across other Dataverse actionss.
  5. Also, Row Filter uses OData style filtering which we’ll omit in this example to keep it simple. 😊
  6. Now, let’s enter a Search Term and keep it simple, I’ll pick an example: “Contoso“.
    Next, look at the Table filter – If I leave it blank it’ll search for Contoso across all Tables in Dataverse.


    Result to show from all Tables as per the above Search rows term –


    Now, I’ll add account and contact (I do have some records in the Opportunity as well which has the keyword ‘Contoso’. So those will be filtered out)


    And the result will be as follows –


    And if we look at the Raw Outputs to see how data is retrieved, we get the below –

  7. Now, let’s look at Sorting.
    Now, in the Sort by filter, I’ll enter the field name ‘name‘ and desc as the order of the Sort.
    And then, we’ll check the results


    And the results were as below –


  8. Next, let’s look at Facet Query. basically, it drills down on the Results which are already returned as a part of the main query and serve as metadata for the same to gather similar information together.
    Here’s how I enter a Facet query – Ex: contact.address1_city. Meaning, it’ll return Address 1: City from all the returned Data and store it under Facet Query.


    Now, when we run this, we’ll get the following results –


  9. Let’s look at what Skip Rows does.
    It’ll only omit the records from the already returned Results. Example: Even if the Result returned 5 records, it’ll Omit/Skip first x records. But still show that the Results returned are whatever the Query is supposed to return.

    In the below example, out of 5, I’ll skip 4 rows.



    And when you run the Query, you’ll find that the Record Count is 5, but only 1 entry was available in the Output.



Which Columns are Searchable?

There are 2 points to keep in mind to know and configure which all columns will the Search be performed on.

  1. If you are aware of how you can configure the Quick Find views in Dynamics 365 CE, same is applicable here since this works off of Relevance Search itself.
    In any Table/Entity’s Quick Find view, make sure the columns are selected in the Add Find Columns

  2. The ones selected in Find Columns are the ones on which the Search will be performed.

Here’s a YouTube video I made to demonstrate the same –

Hope this was useful!

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

  1. Suppress Workflow Header Information while sending back HTTP Response in a Flow | Power Automate
  2. Invalid XML issue in Dataverse connector for List Rows action | Fetch XML Query | Power Automate
  3. FetchXML Aggregation in a Flow using CDS (Current Environment) connector | Power Automate
  4. Invalid type. Expected Integer but got Number error in Parse JSON – Error at runtime after generating Schema | Power Automate
  5. Asynchronous HTTP Response from a Flow | Power Automate
  6. Validate JSON Schema for HTTP Request trigger in a Flow and send Response | Power Automate
  7. Tag a User in a Microsoft Teams post made using Power Automate
  8. Converting JSON to XML and XML to JSON in a Flow | Power Automate
  9. Formatting Approvals’ Details in Cloud Flows | Power Automate
  10. Office 365 Outlook connector in Cloud Flows showing Invalid Connection error | Power Automate
  11. Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
  12. Setting Lookup in a Flow CDS Connector: Classic vs. Current Environment connector | Power Automate Quick Tip

Thank you!

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!!