In several applications, you need to know how many record were retrieved in the List records Action in a Common Data Service connector in order to take a decision.
Scenario
Typically, let’s say I know only 1 record should exist in order to take that record forward and do an action. But how do I know when only 1 record was received? That’s when you use Control
Check Count
Now, let’s say you want to want to retrieve Accounts and know how many were returned (Perhaps, you want to proceed only if at least 1 or more were retrieved)
- This is my List Records action and I’ve named it as Get All Records.
- And just to display how many records are retrieved, I’ll use a variable. Usually, you would use this in condition (which we’ll get to in a bit)
- So, in the expressions to set the Variable, under Dynamic Content, I’ll write –
and write the below expression
which is set to the variable
- And here are the results. I have 101 Accounts
Using it for comparison
This is one of the typical use cases where you want to proceed only if you have at least 1 record –
Here are some more Flow related topics you might want to take a look at –
- Number Formatting in a Flow | Power Automate
- Get N:N records in a Canvas Power App using Common Data Service connector | Power Platform
- Switch-Case in a Flow | Power Automate
- Setting Retry Policy for an HTTP request in a Flow | Power Automate
- Retrieve only active Dynamics 365 CE licensed Users in CDS connector in Power Automate
- Button Flow in Power Automate to replicate a Quick Create Form in D365 CE
- Make HTTP request from Flow in Power Automate
- Create a To-Do List Item of Important Outlook Emails using Power Automate
Hope this quick tip helps!
[…] Get Count of records retrieved in CDS connector in a Flow | Power Automate […]
LikeLike
[…] Get Count of records retrieved in CDS connector in a Flow | Power Automate […]
LikeLike
Reblogged this on Something Awesome About … dynamics, crm, ce, power apps, business apps… and commented:
I am always forgetting this expression …
LikeLike
Thanks so much Olena! 🙂
LikeLike
Gratefful for sharing this
LikeLike
Thanks Richard! Glad this is helpful.
LikeLike