Showing results for 
Search instead for 
Did you mean: 

Nested loops support

The most common issue I run into is the inability to nest foreach loops.


Simple case:


I have a table in Excel with rows of email addresses

I have a CRM entity of Users

I want to find a CRM User by email address and assign their id Guid to a column in the table


1. First I do a Get Rows on the Excel table

2. Next I need a foreach loop over the rows and use the email address from the Output value

3. In ideal case, i'd get list of Users from Dynamics 365, ODATA filtered by email address with limit of 1 result.

4. Continuing the ideal case, then I'd perform Update Row on the Excel row to add the userid from step 3's output to the ID column


Unfortunately, even if I limit results to 1, Flow still demands that I run a foreach loop on the output of the action in Step 3, so now, step 4 needs to be in a nested loop, which causes an error

4. Ideally 

Status: Completed

This work has been completed. You can read more about it here:


In the meantime, I've figured out how to filter to the id using Compose. I only worry that this is an inelegant workaround that might be difficult for some users to figure out.

New Member
Hey michowl,

I assume your workaround works because you're only trying to read from that row inside the loop? I'm trying to get a bunch of rows and then update the corresponding row if it exists for each item. Seems simple but impossible.
Memorable Member

I want Nested loop support, too.


In my scenario, I need "Apply to each" in "Do Until".


1st loop, Do Until

2nd loop, Apply to each



Yoshihiro Kawabata 



Power Automate
Status changed to: Planned
Memorable Member

Awesome, Status become Planned.


I'm waiting the Nested Loop capability.


Currently, I'm build nested loop flow by some Variables and a Do Until loop.



Yoshihiro Kawabata


Power Automate
Status changed to: Started
Helper I

Glad this is getting started, I just keep running into Nested loops and don't have the skills to figure out another way to do this.


Example a leave form

1) Take the User name from the fomr

2) lookup to get user

3) lookup to get manager

4) Send an approval email

5) Approve confirmed

6) FAIL - add another event to create a calendar event to the looked up values of user email and manager email

Advocate II
Advocate II

Still no support for Apply to each within a Do Until?

Power Automate
Status changed to: Completed

This work has been completed. You can read more about it here:

Memorable Member

Thank you @Stephen

for supporting Nested loop.