cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
UnprayingMantis
Advocate II
Advocate II

Parallelism fails for paarovals nested in 'Apply to each'

Hi,

 

Approvals work fine with single level of 'Apply to Each' parallelism on. When approval action is in a nested 'Apply to Each' (parallelism turned on for both outer and inner loops), the loop cycles are not going on.

 

Issue can be reproduced in a simple flow;

  • Create array variable (let's call it outer) with 2 items: outerloopA, outerloopB
  • Create another array (let's call it inner) variable with 2 email addresses: usera@contoso.com, userb@contoso.com
  • Create outer 'Apply to Each' and process outer variable. Turn on concurrency.
    • Create inner 'Apply to Each' within first one and process inner variable. Turn on concurrency. Add an action to send approvals
      To: inner variable
      Subject: outer variable

 

Expected outcome from above sample flow:

  • Each user receives 2 approvals (with outerloopA and outerloopB subjects)

 

Real outcome:

  • usera receives 2 approvals (with outerloopA and outerloopB subjects)
  • userb receives an aprroval only when usera responds to an approval

 

So concurrency setting is only applied first item of outer loop, then behaves like first cycle of outer loop completed and moves on to next outer cycle. Changing "approval type" between anyone/everyone does not change the behavior.

4 REPLIES 4
v-yamao-msft
Community Support
Community Support

Hi @UnprayingMantis,

 

It seems that you enabled Concurrency Control of Apply to each.

Using the concurrency control settings in for each loops can make sure all of the approvers receiver their request at the same time.

Have you bumped the degree of parallelism to the maximum?

I have made the following test.

In my scenario, I am going to get all the items in the list, then send an email with the details of a multiple selection enabled Choice column. A nested apply to each will be automatically created. A screenshot likes below. By the way, I have enabled the concurrency control and set it value to the maximum.

When the flow is triggered, it will send an approval email to both the two email addresses at the same time.

1.PNG

The issue you mentioned could not be reproduced by me.

Please share a screenshot of your flow to help reproduce.

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Mabel,

 

Here is screenshot to repro the issue:
nestedflow1.jpgnestedflow2.jpg

 

regards,

Umut

Hi,

 

Any comments on the behavior?

Hi , 

 

Instead of using Set variable inside loop use compose action. the expression that you are using to set variable can be used in compose as well. 

 

Ref: https://toonvanhoutte.wordpress.com/2018/02/20/variables-in-parallel-for-each-loops/comment-page-1/?...

 

Thanks

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (2,265)