Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Start and Wait for an Approval variables getting mixed values in email body with increased parallelism in Apply to each loop

Hi all, I am building a flow that updates records in Dynamics 365.
I have a get records action that retrieves the required records with a custom OData filter (only records that have approved set to no)

This is all good, then, in an apply to each loop/action using the value output, I retrieve dynamic data from each record such as the application name, application owner (Full Name)  and set their values to variables.

I then have a condition in the loop that if the app owner isn't a certain person, then go create a Start and wait for an approval, with the details/body of the email using the variables I set earlier. All good. See screen-shots below...


The issue is, because I want to send out all the Start and wait for approvals at the same time - to all app owners and not wait until the first one has been approved or rejected,  I need to adjust the degree of parallelism in the loop. When I do this, the variable values start to get messed up and approval mails start containing either the last record's values or/and they all have the same values. Also, the condition where it compares the application owner gets ignored and it sends out approval emails for records where the application owner is equal to Darren Jones...(that's me).  Which it shouldn't do.
I suppose because of the degree of parallelism it's not looping, or not waiting for each loop to complete properly and therefore all values /set variables are being messed up. Is there a way around this. Can't use Create an Approval as there is no output, as I need the approval value for a conditional update of a record later on in the flow.

Any help highly appreciated.

Setvariables .jpg


Level 10

Re: Start and Wait for an Approval variables getting mixed values in email body with increased parallelism in Apply to each loop


You cannot use a Set variable in a loop unless you set the concurrency to 1.

Try using a Compose action instead


If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

Helpful resources


Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.


Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,892)