Power Automate Fundamentals # 46: List Contacts Based on FetchXMLQuery in Power Automate

Introduction:

During certain scenarios we must work on List of records to perform certain operations like sending alerts to list of customers. In these scenarios it is critical to filter records to make sure actual requirement was met. In Power Automate, we can use FetchXMLQuery option under List Rows as an example we can see list of contacts in an environment.

Step 1:

Login to the required Power Apps environment using URL make.powerapps.com by providing username and password and click on Flows on the left-hand side as shown in the below figure.

Step 2:

After Step 1, Click on New Flow and select instant cloud flow and provide the trigger as Manually trigger a flow and click on Create as shown in the below figure.

Step 3:

After Step 2, name the flow as List Contacts Based on FetchXmlQuery take another step  under Dataverse Connector ,  select List Rows action and name it as List rows – Get Contacts and provide the following inputs

Table name : contacts

Fetch Xml Query:

<fetch  top=”50″ >

  <entity name=”contact”>

    <filter>

      <condition attribute=”cr5bc_vaccinationcompleted” operator=”eq” value=”1″ />

    </filter>

  </entity>

</fetch>

as shown in the below figure.

Step 4:

Before Step 3, you can get content of fetchxml query by going into advance find in classic interface of CRM and select contact record and then keep a filter on Vaccination Completed and download fetch xml as shown in the below figure.

Step 5:

After Step 3, take Create HTML Table action and form Header and Value with custom columns option as shown in the below figure.

Step 6:

After Step 5, save flow and run the flow and you should see filtered contact records as shown in the below figure.

Note:

  1. You can observe 200 as status reason for List rows – Get Contacts step as shown in the below figure
  • Make sure to keep enclose body part of list table inside [] array in Step 5.

Conclusion: In this way we can easily filter data in List rows with fetch xml in Power Automate.

One thought on “Power Automate Fundamentals # 46: List Contacts Based on FetchXMLQuery in Power Automate

  1. Pingback: Rewind January 2022 – Common Man Tips for Power Platform, Dynamics CRM,Azure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s