cancel
Showing results for 
Search instead for 
Did you mean: 

Exit from "Apply to Each"

I want to exit from "Apply to Each" for exit the loop.

In some case, the loop does not need processing items after specific item.

 

Regards,

Yoshihiro Kawabata

Status: Under Review

Thank you for suggesting this idea, it is a good suggestion!

Comments
CanardWC
New Member

2017 ... well it's a basic fonction ... and it's not already implemented ? Just to search a similar fonction it takes many time and to make it work like a break take also a lot of time, the code is long and complicate for nothing...

It's just a "break" 4 years to implent this simple fonction ?

rzaw
Regular Visitor

This is much needed.

 

Lets make Power Automate Great!

FabianM
New Member

NEEDED! I have set "Wait for an approval" inside an "Apply to each" with parallelism and if a user rejects, I cannot escape now. Not sure yet how to overcome this. Why is it so completed to allow the TERMINATE action inside this loop?

MartonVilmanyi
Advocate I

Really, 3 years "under review" for something that is not only essential, but would benefit MS as well by reducing unnecessary data load?

Case:

I have a SharePoint list of 5000 rows and using that to find something specific in my database.

I add an Apply to Each loop and enumerate the list

Found the information in the first row

I need to continue with the rest 4999 records, because I cannot exit the loop.

 

CanardWC
New Member

Hi MartonVilmanyi,

 

You can use the filter ODATA when you use "get item" (i think you use this function to get yours items on your flux, it can directly reduce the number of row which are in the For each loop), and i think for MS it's not sooo important because with many functions you can "recreate" a similar break function...

 

MartonVilmanyi
Advocate I

@CanardWC  Was just an example. And there's simple just no way to exit from the All items loop and also no reason why not implementing this. The best workaround is to place a condition inside the loop like "if found then/else" and place the rest to the "not found" path. But it will still enumerate the whole collection, just won't do anything.

FinderFees
Regular Visitor

Adding my voice to this thread that this is much needed functionality. I'm building a flow that will update many records. Would like to exit the loop if I exceed a certain number of failures, but without being able to terminate within a loop I'm stuck to let every single record fail instead of catching and exiting gracefully. It's a real shame it's taking so long to see any movement on this.

MartonVilmanyi
Advocate I

Please, Power Automate Desktop already has an exit loop option, why is it that hard to add to the cloud version?

https://docs.microsoft.com/en-us/power-automate/desktop-flows/actions-reference/loops