function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pawan Kumar 32Pawan Kumar 32 

how to break loop in flow builder

Hi All,

Can anyone please suggest me how can we use break, continue in flow builder loop like apex. I have screen flow where I am using loop Logic. In this loop, if loop veriable contains 3 records/String values then if my condition is met in first iteration; I just want to stop my loop.

Any help regarding this would be highly appriciated.

Thanks in Advance!
Raj VakatiRaj Vakati
 I dnt think so .. you have any option now other than using apex
Vigneshwaran GopalVigneshwaran Gopal
Copied from another source: The break workaround is to clear the loop collection variable.  See Gorav's recommendation on the Salesforce Stack Exchange:
Possible to Break Out of a Loop in Flow Builder?

1. Get Records
2. Assign the records from the Get Records to a record collection variable of the appropriate record/object type (e.g., "The Accounts")
3. Loop on the record collection variable (assigned in step 2) - do not loop on the Get Records record collection
4. Use a decision element to check for you break condition.
5. When you reach your break condition, assign the record collection variable from step 2 (e.g., "The Accounts") to another record collection variable that is empty (e.g. "No Accounts").  When you create this other record collection it will be an empty collection (by default) and just be mindful to not assign it to a non-empty collection. 
Brian Hayes 12Brian Hayes 12
Hi Pawan,
When I saw your question, I thought about my reply to a past IdeaExchange idea. I see that Vigneshwaran has copied it word for word without proper credit. In any case, see the IdeaExchagne post Flow - Add "Break" and "Continue" For Loop Keywords to Flow Loops  at  Please upvote the idea.