How To Get Dataverse List Rows Count Using Power Automate

This Microsoft Dataverse tutorial will discuss how to get dataverse list rows count using Power Automate.

I recently worked on a Dataverse Project where I wanted to use Microsoft Flow to determine the number of Dataverse records.

Using a simple scenario, I’ll demonstrate how to utilize Power Automate to find the dataverse list rows count.

Also Read: How to get data from Dataverse in Power Apps

Get Dataverse List Rows Count Using Power Automate

It is occasionally necessary to determine the total number of records in a table while working with a list of records for a particular thing in order to execute specific manipulations.

Here, you can utilize Power Automate’s length function to find the number of records in a given list.

To get all the dataverse list rows count using Microsoft flow, we can follow the instructions below:

  • A Dataverse table called Car Details is visible in the screenshot that follows. As you can see, certain columns include various types of data. Additionally, this table contains the following 11 records.
  • I now want to use Power Automate to count all the rows in these dataverse tables.
Power Automate Dataverse List Rows Count
Power Automate Dataverse List Rows Count
  • First, using the URL make.powerapps.com, sign in to the power Apps environment by entering your login and password. Go to the Flows (from the left menu) -> Click on the + New flow -> Choose Instant cloud flow under the Build your own from blank section.
  • Also, you can create a new flow by using make.powerautomate.com (Microsoft Flow login page) directly.
Dataverse List Rows Count using Power Automate
Dataverse List Rows Count using Power Automate
  • Next, provide a unique flow name (Car Info Count) and choose how to trigger the flow (where I have chosen Manually trigger a flow). Click on Create.
power automate dataverse count list rows
power automate dataverse count list rows
  • The flow will appear as seen in the screenshot below once it has been established. To add a new action, click the + New step button after that.
Dataverse count list rows using power automate
Dataverse count list rows using power automate
  • Search List rows in the search bar and select the List rows (PREMIUM) action under the Microsoft Dataverse section as shown below.
  • Just rename the action once the List rows action has been added to the flow (List rows – Get Car Details). Provide the input below:
    • Table name = Expand the down arrow and select your standard or custom table (Car Details).
Dataverse List Rows Count in Power Automate
Dataverse List Rows Count in Power Automate
  • To add an initialize variable action, click the + New step button after that. Initialize variable can be found under the Variable section by searching Variable in the search field.
Dataverse List Rows Count using flow
Dataverse List Rows Count using flow
  • Once the variable has been added to the flow, simply rename the action (Initialize variable – Get Car Count). Provide the input below:
    • Name = Provide a name to the variable action.
    • Type = Select the variable type as Integer from the dropdown menu.
    • Value = For the value field, we need to apply the formula below in the Expression tab.
length(outputs('List_rows_-_Get_Car_Details')?['body/value'])

Where,

  1. length = The length function in Power Automate returns the size of a string (number of characters) or an array (number of elements for an array).
  2. List_rows_-_Get_Car_Details‘ = The list rows action is known by this name. The proper name must be enclosed in a single inverted comma including an underscore.
  • Once the code is verified and everything is done, click on OK. The Update button is visible in the example below because the formula has already been applied to the Value field.
How to Count Dataverse List Rows using Power Automate
How to Count Dataverse List Rows using Power Automate
  • That is all there is to do in Power Automate. The entire flow structure will resemble the illustration below. Now save and test the flow. Click on Save.
Count Dataverse List Rows using Power Automate
Count Dataverse List Rows using Power Automate
  • Once you click on Save, a flow checker popup will appear where it displays the warning message below:
See also  Convert String to Integer in Power Automate

Updating action ‘List rows – Get Car Details’ to use OData filter queries can improve the performance of your flow. Learn more: https://flow.microsoft.com/blog/advanced-flow-of-the-week-filtering-with-odata“.

  • It states that an OData filter should be provided for the dataverse list. But since my goal is to count the records, I haven’t provided any filter.
  • As soon as we dismiss the warning message, a successful message in the color green, i.e “Your flow is ready to go. We recommend you test it“.
Count Dataverse List Rows using flow
Count Dataverse List Rows using flow
  • To test the flow, click on the top Test button -> Select Manually -> Test as below.
Power Automate Dataverse List Row Count
Power Automate Dataverse List Row Count
  • After that, click the Run flow button below, and the successful window will show up where it says that “Your flow run successfully started. To monitor it, go to the Flow Runs Page“. Click on Done.
Dataverse List Row Count using flow
Dataverse List Row Count using flow
  • Finally, the successful notice shows that the flow ran successfully. To view the output, expand Initialize variable – Get Car Count action and go to the Value field. From the specific dataverse table (Car Details), you can see that there are 11 records in total.
How to use Power Automate Dataverse List Rows Count
How to use Power Automate Dataverse List Rows Count

This is how you use the list action’s length function to quickly obtain the record count from the dataverse table.

Furthermore, you may like some more Dataverse tutorials:

See also  How To Get Row by ID From Dataverse Table

In this Dataverse tutorial, we discussed how to get dataverse list rows count using Power Automate.

>