Power Automate / Dataverse: Get first result

Power Automate has so many options and possibilities by clicking through the user interface. But it can do even more with the help of expressions. I think I use the following two experssion the most, empty() and first(). Thats why I wanted to share them with you.

Get the first returned value

When looking for a record in the Dataverse, but the record id is unknown we use the action List Rows. This action always returns an array of values. This even happens when only one record is returned. If you try to use the returned value to for example update the found record, then Power Automate automatically generates an apply for each loop. This can be confusing when developing the flow, why would it loop through all the values when there is just one? With the first() expression we can prevent Power Automate to automatically generates an apply for each loop.

  • Add the Dataverse action list rows and configure it to find the unique record.
  • In my example I look for the unique record based on the unique order id.
  • When trying to update the found record the following Apply for each will be automatically generated.
  • The creation of the Apply for each can be prevent by using the expression first().
  • Remove the Apply for each and the Update a row action.
  • Add a new Update a row action and open the expression tab.
  • Add the expression first(body(‘Internal_name_of_the_list_row_action’)?[‘value’])?[‘internal_field_name’].
  • This expression returns the first specified field value from the value array in the returned body of the list row action.

Check if the returned result is empty

In my Cloud Flow I needed to check if a List rows action did not return a value. This is not an option in the drop down list, but it can be done using the empty expression.

  • Add the condition action.
  • Open the expression tab.
  • Add the expression empty(output(‘Internal_name_of_the_list_row_action’)?[‘body/value’]).
  • This checks if the returned body have any values, with other words checks if the value is empty.

3 Replies to “Power Automate / Dataverse: Get first result”

  1. Hi ismail,

    ‘Internal_name_of_the_list_row_action’ is the name of the ‘List rows’ action you add to the flow. By default the name of the action is ‘List rows’, so with such name the Ben’s expression would look like the following:


    If your ‘List rows’ action is renamed, then you have to change the name in the expression as well. Let’s say you rename the action to ‘List rows – Contact table’, the expression would look like this:


  2. Hi, thanks so much for sharing this to me. it is helpful!

    You mentioned “This action always returns an array of values. This even happens when only one record is returned”— Can i have a example about what the array/ record look like?


Leave a Reply

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