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 / Do Until Loop Termination
Power Automate
Unanswered

Do Until Loop Termination

(0) ShareShare
ReportReport
Posted on by 674

In a Do Until loop, with a condition (such as a certain variable is greater than 1), at what point does the do Until loop stop?  Does it stop at the beginning of the iteration when the condition is met (and thus does not implement actions below it once the condition is met) or does it see that the condition is met, run the loop once more, and then quit?

Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    In my experience it evaluates the condition at the top of the loop.  So if the condition is true when you enter the loop it will never execute the actions inside the loop.

  • DavidYack Profile Picture
    66 Most Valuable Professional on at

    It should do the actions once and then move on

     

    Do (run the actions) then Until (check the condition)

  • 55552 Profile Picture
    674 on at

    Thanks for that answer, very helpful. One other question.  Will a Do Until work properly if it is embedded inside an Apply to Each loop?  In my case, I am checking a condition to see if it is true, but I need an apply to each loop for to check each record in a SharePoint list.  I'm not sure if Do Until works properly inside a loop.  See screenshot. "Loop daily list" is an apply to each loop that gets records (items) from a SharePoint list, then uses an item from that list in the do until comparison.  I am trying to get the list loop to exit once the condition is met, to avoid unnecessary repetitions.

     
     
  • 55552 Profile Picture
    674 on at

    my post below did not seem to keep the screenshot.  Trying again.DoUntilFlow.png

     

  • 55552 Profile Picture
    674 on at

    From my testing, I have not found a way to exit a loop before all items in the Apply to Each loop are completed. I tried using a Do Until loop with a condition, but as soon as the condition involves multiple items from a SharePoint list, an Apply to Each loop is added, and that loop will not exit until all items have been checked.

    My conclusion is that loops which involve checking multiple items in a list or library cannot be exited early based on conditions.  We really need a "break" function.

    If anyone has figured out a way to exit a loop (where repeating items are involved), please let the community know.

  • cerberus Profile Picture
    13 on at

    Honestly cannot believe that a "break" hasn't been implemented.

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    Do until will work fine inside an Apply to Each, but breaking out of the Do Until will just run the next apply to each loop.  There is no way to break out of an apply to each loop without terminating the entire flow.

  • cerberus Profile Picture
    13 on at

    Which is preposterous.

  • Pstork1 Profile Picture
    68,697 Most Valuable Professional on at

    Why is that preposterous?  Its apply to each, not apply to them until I decide differently.  You can easily replace the Apply to each with a do until loop and get the ability to break out of the loop.  Just because doesn't work the way you want it to doesn't make it wrong or preposterous.

  • cerberus Profile Picture
    13 on at

    Apologies - I shouldn't have said that yesterday. 😔 I find the user interface very frustrating to use and my temper got the better of me.

     

    I was concerned that using a do until would be inelegant if the condition is never satisfied but I know that we can limit the number of executions. I will try this.

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard