Use FetchXML in the Power Automate CDS Connector for List Records

4 Comments

In this post, we will look at how to use FetchXML in the Power Automate Common Data Service Connector to retrieve records using the List Records Action.

If you prefer to learn by video, check out my YouTube channel video on how to do this:

First, log into https://flow.microsoft.com and go to Solutions and create a new solution:

Give it a name and click Create:

Open the solution and click New->Flow:

We will trigger this from a Flow Button. Let’s select Manually trigger a flow:

You should see:

Search for Common Data Service and choose the Common Data Service Current Environment connector and select List Records (don’t choose the Common Data Service connector without the Current Environment or you will not see the FetchXML option later):

Select your environments and click Show advanced options:

Clicking show advanced options, we see the FetchXML Query:

Let’s create a FetchXML query to use. We will use the FetchXML Builder in the XrmToolbox. You could also use Advanced Find or your preferred tool to create FetchXML:

Create a new query:

We will create a query where the revenue of the account is greater than $1M:

Copy the FetchXML:

And let’s throw it into our Flow:

Save the Flow and let’s test it:

Once complete, look at the flow run. For the output of the List Records, we get a 200 OK status:

And in our HTML body we get the fields we selected, name and revenue, displaying accounts with $1M revenue:

A useful feature if you would like to take advantage of FetchXML in Power Automate.

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

4 Responses to Use FetchXML in the Power Automate CDS Connector for List Records

    • Hi

      Is it possible to automatically read the fetchxml from an advanced find query name and pass it in a flow ? (Not to manually copy and paste the fetchxml but to read it automatically from a view name)

      Thank you

  1. Hey Carl,

    Appreciate you posting this article. However I do have one question, I am using the same scenario and it seems to be working fine but what can i do if i have a resultset more than 5000 records?

    Because currently I am listing records and creating a csv file and it only contains 5000 records but the whole resultset is around 20K.

    Any help would be really appreciated

  2. Hi,
    Nice blogs… I have one query to run scheduled flow in power automate but it should exclude wekends as in the calculation part am doing fetchxml older than 48 hrs so it shouldnot count in weekends.
    How can we achieve in ms flow ?

Leave a Reply

Your email address will not be published. Required fields are marked *