Use List Records in Power Automate Flow to Create and Send CDS Report Data

3 Comments

List Records is an action in the Common Data Service connector in Power Automate Flow that lists records based on a query you provide to the Common Data Service. The results can then be sent somewhere, such as in an email or posted to a Microsoft Teams chat. In this post, we will look at how to use List Records to do both these things.

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

First, log into https://flow.microsoft.com and create an Instant flow:

We will run it on pressing a button in Power Automate by using the Manually Trigger a Flow trigger:

We see below. Click + New Step:

Find Common Data Service and select List Records:

Choose your Environment and Entity Name. We will select the Accounts entity so we can create a report of accounts from our Common Data Service / Dynamics 365 environment:

Selecting Advanced Options, we see we can add additional criteria to our request, such as filtering, ordering, top count, and expand query:

Let’s save this:

And test the flow:

Go to the Flow Runs Page:

We see the flow ran successfully. Let’s look and the output. Click to Download:

We see we get a JSON output file:

Let’s make something more user-friendly. Let’s convert this output to an HTML table:

Save and run this:

We see in the output we’re now getting HTML:

Now instead of all columns, let’s order by the Account Name and only display that in the HTML:

Rerun the flow. We see a nice HTML table now produced with one column:

Now let’s filter even more and get the top 10 accounts by revenue, ordered descending:

And display the revenue as well:

We see a nice output in the body:

Now that we have this, we will want to do something with it. First, let’s create an email to send with this data. Add the Send an Email action from the Office 365 Outlook connector:

We will add the output to the body of the email:

On running this, we see our email output. Very useful if we want a report that can be run easily through flow:

Finally, let’s post this to Microsoft Teams:

Select Post a Message:

Add the Output to the Message:

Run the Flow. We now see the message in Teams when we run the Flow!

 

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

 

3 Responses to Use List Records in Power Automate Flow to Create and Send CDS Report Data

  1. Hi Carl,
    This has been useful for my use case, however i’m stuck on including Lookup Field labels in the HTML Table.
    How would you go about getting the Owner Name of the Accounts listing in your email?

Leave a Reply

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