Skip to main content

Notifications

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

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.

codevenkat_0-1641577522305.png

 

 

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.

codevenkat_1-1641577535608.png

 

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.

codevenkat_2-1641577547488.png

 

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.

codevenkat_3-1641577553477.png

 

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.

codevenkat_4-1641577564594.png

 

Step 6:

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

codevenkat_5-1641577573967.png

 

 

Note:

  1. You can observe 200 as status reason for List rows – Get Contacts step as shown in the below figure

 

Figure 7

  1. 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.

Comments

*This post is locked for comments