cancel
Showing results for 
Search instead for 
Did you mean: 

Flow loop break

One of the most basic thing that I would like to be implemented in flow is a break action to break out of foreach and do untill loops. 

Status: New
Comments
Advocate II

Agreed! I just encountered timeout problem with a HTTP Request/Response flow, because I had to loop a large json-object to find a specific value. The loop (actually loops) took too long. I would be able to cut the execution time in half if I could break the loops when I found what I was looking for.

 

PS. The timeout problem was fixed by running the Response in async mode.

Frequent Visitor

Any progress on this idea

 

Regular Visitor

this is a must have please implement it

No update from Dev team?

Frequent Visitor

Not only is this necessary, but I will NEVER use Microsoft Flow again until this is implemented properly with "Break and Succeed," "Break and Fail," or "Break and Cancel." An action in my For Each loop has been failing over and over again, and I hear that the loop would continue iteration even if I converted it into a Do Until loop (https://powerusers.microsoft.com/t5/I-Found-A-Bug/Errors-in-loops-are-eaten/td-p/192204).  If only my Flow would fail in a reasonable amount of time, I could catch every error that was failing because I stupidly overlooked one thing, and there were about ten of those inside loops.

Frequent Visitor

It's pretty easy to implement a break. Set a variable before your loop starts to 1. Add an additional condition for your loop that checks if that variable = 1. When you would like to break, just set the variable to 0.

 

I do agree it would be nice to have an option for breaking instead of having to do this, but this seems pretty easy to implement.

Regular Visitor

In fact, an action to break a loop is essential.

 

Is this action likely to be implemented?

Frequent Visitor

Just wanted to add that the ability to break becomes even more essential when loop iterations are lengthy.

 

For example, in a scenario where each iteration takes 24 hours (because of a 'delay' step) even if you set up a variable to break the loop it goes through the full length of the iteration before breaking.

 

Edit: I just realised it's possible to work around this with conditional logic (i.e. only wait for 24 hours if the "end loop" variable is false) but it's a little messy and hard for others to understand if they're trying to work out what the flow is doing. Breaking would be much cleaner!