I'm trying to use a loop in my flow, which will apply multiple actions to each item in an array. I have read that an "Apply to Each" loop can only apply one action to each item, and indeed if I add multiple actions to the loop it errors out with "The input parameter(s) of operation 'Apply_to_each' contains invalid expression(s). Fix invalid expression(s) for the input parameter(s) of operation 'Apply_to_each'". This error doesn't appear and the flow runs successfully if I only apply one action. The second action in the loop does not contain an error, it's a simple compose.
So I think I need a "For Each" loop but that doesn't appear anywhere in the list of actions. My only loop options in Control are "Apply to Each" or "Do Until". However I know that "For each" still exists, because in one of my other flows it kept appearing automatically in mysterious circumstances.
I've searched until I'm blue in the face but can't find a solution, can anyone help? Thanks.
EDIT: It turns out I did have an error in the second action but that reports an error in the loop rather than the action itself, which is why I was confused, so now I can get two actions in the loop. However, I still don't understand if "For Each" is a valid action - I have checked and I have another flow containing "For Each", which I created yesterday, but I'm not clear on the difference with "Apply to Each" and how to insert "For Each". Can anyone clarify whether "For Each" is still a supported action, what the difference is with "Apply to Each" and how to insert it?
Today I saw the "For Each" action appeared in my flow, and I was also confused since I didn't know it exist. Reading this post and @v-bofeng-msft answer - it became clear. Power Automate added the "Apply to each" action for me (and for you as well), as it always does when you are using an array as an input to another action, without realizing that an "Apply to each" is necessary. The difference is with the new designer it is now added with the name "For each" instead of with "Apply to each". But it is the same action.
Got it, that makes complete sense. What doesn't make sense is that I didn't change the name, and nor did I insert it, it somehow appeared automatically. It could be that there's a template but I didn't create any templates and I'm the only user in our organisation that has used Power Automate. However, I can survive without knowing the answer to that mystery now I know the answer to my original question. Thanks.
Hi @cambridgepic ,
Once an action is added to the flow, its name can be changed freely. The action in your screenshot is 'Apply to each.' The reason it appears as 'For Each' could be that you used a template, someone renamed it, or there might be another reason that I am unaware of.
Best Regards,
Bof
There is, it's possible it is deprecated but see this screenshot of one of my flows this morning (created two days ago).
Hi @cambridgepic ,
I'm afraid there is no such an action named 'For each'. From a functional perspective, I believe you can regard 'Apply to each' as equivalent to 'For each'.
Best Regards,
Bof
WarrenBelz
146,743
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,079
Most Valuable Professional