cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamics 365 for Operations - Get records: How to identify if any record was retrieved?

Dear,

 

Regarding the Dynamics 365 for Operations - Get records.

Currently there is no way to be able to control the flow based on the number of fetched records.

 

I.E. in many cases it is important to be able to decide if a given records is existing or not to be able to decide the flow control.

 

See also:

https://powerusers.microsoft.com/t5/Flow-Forum/Dynamics-365-for-Operations-Get-records-How-to-identi...

 

Kind regards,

MegrdadG

Comments
Level: Power Up

Hi ,

 

i'm also having similar requirement i.e  control the flow based on the number of fetched records.

 

Any inputs on how to handle this issue?

 

Thanks

keerthi.ch

 

Microsoft Employee

You can use Compose and Workflow Definition Language to get the length of the array returned by a Get Records call:

 

"@length(body('List_records')?['value'])"

 

Try that out. If it's giving you the length of the string (treating the json object as a string), then try explicitly converting to json or an array:

 

"@length(json(body('List_records')?['value']))"

"@length(array(json(body('List_records')?['value'])))"

 

Reference: https://docs.microsoft.com/en-us/rest/api/logic/definition-language#functions