web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Exit the current Apply...
Power Automate
Unanswered

Exit the current ApplyToEach iteration incase a variable is set to true

(0) ShareShare
ReportReport
Posted on by 1,811 Super User 2024 Season 1
I have 3 SharePoint lists:-
 
1) Posting Process
2) Posting Forms
3) Posting Process Posting Form. which stores the relation between the above 2 lists using the ID of the above list items.
 
And i want to build a process that email the managers when the Posting Process is completed (All the Posting Forms have their status as "Done")
 
Now in the schduled flow i am doing the following:- I am getting all the active "Posting Process" items >> then for each Process i am getting all the "Posting Process Posting Form" items >> then for each "Posting Process Posting Form" item >> I am getting the related "Posting Form" and check it is status = "New" or "Work Order Created" >> If so then this means that the Process still has at-least one not completed form...
 
Here the related sections of my work flow:-
 
 
1) First I am getting all the active processes + i am setting a variable to false:-
 
 
2) Loop through all the Active Processes >> and get all the relation items >> get the related Form, as follow:-
 
 
3) check the Form status it is not set to Done (either Status = New or  = Work Order Created) >> if so set the Variable to True:-
 
Here is the overall steps:-
 
 
 
But the issue i am facing is with the efficiency of this flow. because if there is one Form with status = New Or =Work Order Created and i set the variable to true.. then i do not need to continue the current iteration of the ApplytoEach.. and i need to skip it and execute the next iteration and so on... so how i can achieve this inside my above actions? to improve the performance of my flow??
 
Thanks in advance for any help..
Categories:
I have the same question (0)
  • tgraham Profile Picture
    73 on at
    Instead of using Apply to Each, use Do Until. Condition should be when Variable equals ____. Once true, the loop stops. 
  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at
    tgraham
    Thanks for the reply. I never worked with DoUntil before, so you mean i will have all my current ApplytoEach inside a DoUntil ? or DoUntil will replace the whole ApplyToEach?

    A quick screen shot or drawing will help much
  • tgraham Profile Picture
    73 on at
    @johnjohnPter replace the Apply to Each with Do Until. Here's an example: https://tomriha.com/how-to-pause-power-automate-flow-until-sharepoint-column-has-a-value/ 
  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at
     
    Ok thanks but in my case i need to iterate over the Process Items and to iteration over the relation items  i get from the GetItem action and at the same time i need to have a DoUntil??

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard