How to use the Do until loop in Power Automate
Add a Do until control, set a condition that ends the loop, and put the repeating actions inside it. The flow runs the actions first, then checks the condition, and repeats until the condition is true or a limit is reached.
When should you use Do until instead of Apply to each?
Use Do until when you do not know how many times to repeat. Examples: wait for a status to change, or call a service until it returns a result.
Use Apply to each when you have a list of items and want one pass per item. For speed on lists, see our guide on Apply to each concurrency.
How do you add a Do until loop?
- Select New step, then search for Do until under Control.
- In the first box, choose the value to test, such as a variable named Done.
- Choose the operator, such as is equal to, and type the value that ends the loop, such as true.
- Add the actions to repeat inside the loop.
- Add a Delay action inside the loop so it does not run at full speed.
- Inside the loop, add the action that changes the tested value, such as Set variable.
Does Do until check the condition first or last?
Last. The loop runs its actions once, then checks the condition. If the condition is already true, the actions still run one time.
If you need zero runs, put a Condition before the Do until.
What are the Do until limits?
Microsoft lists the Until iteration limit as 60 by default and 5,000 at most. The default timeout is one hour, shown as PT1H.
Open Change limits on the Do until card to raise the Count or the Timeout. The loop stops when either limit is reached, even if the condition is still false.
For waits longer than a few days, a loop is the wrong tool. See our guide on Delay until beyond 30 days.
Why does my Do until loop never end?
- Nothing inside the loop changes the tested value. Add a Set variable or an Update action.
- The test compares text to a number, or the reverse. Match the types.
- A choice column returns an object. Test the Value field, not the whole column.
- The value is empty and never matches. See our guide on Condition field is empty.
- The limits are high and there is no Delay. Lower the Count while you test.
Why does the flow show Succeeded when the loop hit its limit?
A Do until loop that reaches its Count or Timeout can still end as Succeeded, so the flow carries on as if the condition were met.
After the loop, add a Condition that checks the tested value again. If it is still false, send an alert or use Terminate with a Failed status.
What should you check before you rely on a Do until?
- Run the flow with a value that ends the loop on the first pass.
- Run it with a value that never ends the loop, and confirm the limit stops it.
- Open the run history and count the iterations.
FAQ
What is the default Do until limit in Power Automate?
Sixty iterations, with a maximum of 5,000. The card also has a timeout of one hour by default.
Do I need a Delay inside Do until?
Not required, but you should add one. Without it the loop can use up its Count in seconds.
Can a Do until loop run zero times?
No. It runs once before it checks the condition. Add a Condition before it to skip it.
Can I put a Do until inside Apply to each?
Yes. Each item then gets its own loop, so keep the Count low.