Is there a way to create loop inside another loop?
I got an error: The template action 'Apply_to_each_3' at line '1' and column '2271' is not valid. Only actions of type other than 'foreach' are allowed to be nested under an action of type 'foreach'.
I need to get excel names from list and join rows from them to one file
Solved! Go to Solution.
According to my test, you cannot add loop inside another loop in Flow so far. In that case, you could create 2 separate flows. If you need my help to know how to achieve your requirement using two flows, please describe more clearly about your needs. Thanks.
I'm guessing the solution was of this pattern: -
First workflow loops the source domain of items, running whatever actions, and writes each items into an SP list.
The list has a workflow attached triggered when a new item is added to the list. So the workflow runs for each item added to this list, which de facto implements the first loop but allows a loop inside each execution of the workflow i.e. per item.
It works, but it's a sure way to burn through your Flow quota, coz you're running a Flow for each item to implement the second inner loop, rather than a running one Flow with two for each's in it.
Which is probably why MS engineered it this way.
Nested for each is available now. Just need to create variables in the first loop to hold values from the current item, and then look at the variable within the nested for each.
I thought the current iteration of the first for each would automatically be passed into the nested for each, but alas not. At least you won't have to burn through your flow quota like wildfire now!
Join us for the first ever Power Platform Online Conference!
Look out for new contribution recognition badges coming SOON!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!