Power Automate Do Until [With Examples]

In this tutorial, I will describe how to use the Do Until action in Power Automate and how to configure its key parameters, such as Count and Timeout.

While working on a Leave Management App approval process, I needed to wait until multiple conditions were met, such as the leave request being marked as approved and a manager’s comment being provided.

To handle this, I used the “Do Until” action in Power Automate, which helped me repeat specific actions until both conditions were met.

Along with the main concept, I have also covered What is Do Until loop in Power Automate, Power Automate Do Until limits, Power Automate delay until a specific time, How to delay until a particular time inside a Do Until loop, and how to Add Multiple Conditions in Power Automate Do Until Action.

What is Do Until in Power Automate?

The Do Until action in Power Automate is a type of loop that continues to run a group of actions until a specific condition is met.

Unlike the Apply to Each loop, which runs a fixed number of times (based on an array), the Do Until loop keeps repeating until your condition is met, no matter how long it takes, or how many times it needs to check.

Configure Do Until in Power Automate

When you add the Do Until action in Power Automate, you can control the loop’s duration and repetition count by configuring the advanced settings.

To view these settings, click “Show all” to display the advanced parameters, where you can change the limits.

  • Count: The Count property defines the maximum number of times the loop can run. If the condition is not satisfied, the loop will repeat until it hits the defined count. If the condition is satisfied before the loop reaches the count, it will stop automatically.
  • Timeout: The Timeout property specifies the duration for which the loop should continue running. If the condition is never satisfied, the loop will stop automatically after the timeout period. The timeout value must be provided in ISO 8601 format.

Examples:

  • P1D – 1 day, and D is the day unit
  • PT1H – 1 hour, T represents time units and H for Hour
  • PT4M – equals to 4 minutes
  • P4DT4H4m – is 4 days, 4 hours, 4 minutes

The Do Until loop stops if the condition is satisfied to true, the count number is reached, or the time-out duration is reached.

Do until in Power Automate

Read Convert Time Zone in Power Automate

Do Until Limits in Power Automate

By default, it will take the count value as 60, which means the loop will repeat 60 times.

Note:

Power Automate Do until Count Limit: The maximum limit of count value, we can set is 5000.
power automate do until limits count

Time Out Limit: By default, it will show the time out value as PT1H, which means 1 Hour.

Note:

The maximum limit of timeout value is P30D or P1M, that represents 30 days or 1 month the Do until loop will repeat.
do until power automate limits

This is all about the Do Until loop and how to configure and limit it in a Power Automate flow.

Do Until Loop in Power Automate Example

To check on how to work with the Do until loop in Power Automate, follow the example below:

Example: Let me show you a simple example of how Do Until will work in Power Automate by building an Instant cloud flow.

Suppose I will take the integer value in a variable as ‘10‘. My requirement is to increase this variable value to 100.

Follow the steps below:

  1. On the Power Automate Home page, go to +Create –> Instant cloud flow to trigger a flow manually.
  2. Now, add an action to initialize a variable. Then click on +New step > Initialize a variable. Set the parameters below to initialize the variable:
    • Name– Give a variable name
    • Type– Select the type from the drop-down i.e., Integer
    • Value– Set an initial value for the variable, i.e., 10
do until power automate timeout and count
  1. Next, add the do until control action to check until the condition matches the specified value [100]. Set the values such as:
    • Choose a value(1st)– Number
    • Operator– Is equal to
    • Choose a value(2nd)– 100
do until power automate count

According to the condition, the flow will run until the variable equals 100.

  1. Add a Compose action inside the ‘do until‘ action to show the variable value. Take the initialized variable value.
power automate do until limit
  1. After that, I will add an action to increase the variable with a specified value. Select the Increment variable. Set the variable name and the value that will increment.
power automate do until example
  1. Let’s save the flow and test it manually. Then click on Test > Run the flow. The flow will run successfully, and the loop will stop when the provided condition is met, i.e., until the variable value equals 100.

Refer to the image below:

Do until using power automate

This is how to use the do-until loop in Power Automate.

Read Copy List Items To Another List In SharePoint Using Power Automate

Power Automate Do Until Count

Here, let’s check an example of how to work with the do until count for the loop condition in Power Automate.

Example:

I have taken a SharePoint list named ‘Project Tracker‘ with a few columns that look like in the image below:

power automate do until

My requirement is: By default, Is Approved? The column will be set to ‘No’; the flow will repeat until the manager sets ‘Is Approved’ to ‘Yes’ and emails the assigned person about project approval.

If the Is Approved column is not approved, the loop will continue to run.

Check the steps below:

  1. In the Power Automate Home page, create an Automated cloud flow with a ‘When an item is created’ trigger. Set the site address and list name.
  2. Next, add an Initialize Variable to set the boolean value. Provide name, type as a boolean, and value as false.
do until loop in power automate
  1. After that, add a Do Until action, and in the Loop Until parameter, choose the value like below:
    • Count: Here, I am taking the count value as 10; you can take it according to your requirements.

The loop will repeat when the given condition is met, or the count value is reached.

Choose ValueOperatorChoose Value
Project Completed (Initialize variable)is equal totrue
Power Automate do until limits
  1. Under the Do Until loop, add an action to delay and continue the flow repeat for 5 seconds.
    • Count: Take count according to your need.
    • Unit: Select the time unit from the drop-down options.
power automate do until count
  1. After that, add the Condition control action to set the condition as below:
Condition Expression: Is Approved is equal to true
how to use do until in power automate
  1. Then, take the Set variable under True condition and set the parameters like below:
    • Name: Choose a name from the drop-down.
    • Value: Enter value as true.
Power automate do until loop count
  1. Then, add the Send an email(V2) flow action and fill in the details like To as assigned person email, subject, and Body.
do until count power automate
  1. Now, save and test the flow. Create an item in the SharePoint list like below:
do until loop count power automate
  1. The flow will trigger and start running when the item is created in the SharePoint list. The Do until loop will continue to repeat in the image.

Note:

The Do until loop will repeat until the condition is met or count we provided is reached.
Power Automate Do until count loop
  1. Now, chnage Is Approved? If the column value is Yes, the condition will be met and stop the loop repetition.
do while loop in power automate
  1. The image below represents the number of times the loop has repeated before the condition is satisfied.
Microsoft power automate do until count

This is how to use Do Until loop count in Power Automate.

Power Automate Do Until Timeout PT1H

To work with Power Automate, do until loop timeout for 1 hour. Check out the requirements below.

Example:

I have created a SharePoint list named ‘Products Ordered Details’ with several columns.

Refer to the image below:

Timeout in do until Power Automate

In the above SharePoint list, when a user adds an item to the list:

  • An approval request should be sent to the Review By. If the outcome of the approval request is ‘Approved’, update the Discount Approved field.
  • If the condition is not met, the loop will continue for 1 hour and then stop.

Go through the steps below:

  1. In the Automate cloud flow, choose the ‘When an item is created‘ trigger. Set the parameters such as Site Address and List Name.
do until timeout in Power Automate
  1. After that, add a Do Until loop to repeat the loop until the Approval request is approved.
Choose ValueOperatorChoose Value
Outcome of approval requestis equal toApprove
power automate pt1h
  1. After that, Start and wait for an approval flow action, set the required properties:
    • Approval type– Approve/Reject – First to Respond.
    • Title– Select Title from dynamic content.
    • Assigned to– Approver name, email from dynamic content.
    • Details– Set the details of the approval request.
power automate do until timeout pt1h
  1. After that, I will take a Condition control flow action to provide a condition to check whether the outcome is Approved or rejected.
Choose ValueOperatorChoose Value
Outcomeis equal toApprove
do until power automate timeout
  1. Under the True condition, add the Update item flow action to update the item with an approved discount. Configure the parameters, such as the site address and list name.
    • Id: Take the Id column from the dynamic content.
    • Title: Choose the Title column from the dynamic content.
    • Discount Approved?: Select Yes from the drop-down.
pt1h timeout in Power Automate
  1. Under the False condition, take the Update item flow action to update the approved discount value. Set the parameters, such as site address, List name, ID, and Title, from the dynamic content.
    • Discount Approved?: Select No from the drop-down options.
do until timeout power automate
  1. Now that the flow is ready, save and run it manually once. To trigger the flow, add an item to the SharePoint list, as you can see from the image below:
power automate do until pt1h
  1. Now, you can see that the do-until loop will continue to execute repeatedly until it meets the condition or the timeout we provided.
power automate do until count and timeout
  1. If the approval outcome is approved, the do-until loop will terminate, and the flow will execute successfully.

Otherwise, the loop will repeat until the provided timeout, i.e., one hour, and then stop.

power automate do until timeout 1 hour

This is how to provide a time-out in the Do until loop using Power Automate.

Add Multiple Conditions in Power Automate Do Until Action

Sometimes, in real-world automation scenarios, you need your Do Until loop to run until multiple conditions are satisfied, not just one. Power Automate enables you to add multiple conditions using advanced mode or logical operators, such as AND and OR.

Let’s say you have a SharePoint Document Library named “Project Documents”, and each document has metadata columns:

Column NameType
ReviewStatusChoice (Not Started, In Progress, Completed)
ReviewerCommentsMultiple lines of text
power automate do until multiple conditions

When a file is added to a SharePoint document library, the manager needs to: Change the file’s status to Completed and add reviewer comments. If the manager does not complete the task within 10 hours, they should receive a reminder email every 10 hours.

Once the manager updates both the status and comments, the person who uploaded the file will receive a notification email confirming the review is completed.

Now follow the steps below:

  1. Go to Power Automate, click Create, and then select Automated Cloud Flow. Give a Flow name: Wait for Review with Manager Reminders. Choose trigger: When a file is created (properties only). Click Create. Then add the following parameters:
    • Site Address: Your SharePoint site
    • Library Name: Project Documents
power automate do until two conditions
  1. Then, add ‘Get File Properties’ and use the same Site Address and Library Name. Next, select ID from the trigger.
Using an OR condition inside a Do-Until loop in Power Autoamte
  1. Add ‘Do Until’ Control with Multiple Conditions. Click Edit in advanced mode and paste this expression:
@and(equals(outputs('Get_file_properties')?['body/ReviewStatus/Value'], 'Completed'), not(equals(outputs('Get_file_properties')?['ReviewerComments'], '')))
Multiple conditions for Do Until Power Automate
  1. Then drag ‘Get file properties’ inside the do until. After that, add a Send an email action to notify the manager:
    • To: Manager’s email.
    • Subject: Reminder: Please review the document @{triggerBody()?[‘{Name}’]}
    • Body:
Hi Manager,

Please complete the review for the document: @{triggerBody()?['{Name}']}}.

Update the Review Status to "Completed" and add your Reviewer Comments.

Thanks.
power automate multiple do until conditions
  1. Still inside the Do Until loop, Add Delay action set below the parameters:
    • Count: 10
    • Unit: Hours
How Do Until Loops Can Help You Power Automate

Once the loop ends (i.e., the review is complete), send an email to the person who created the document.

  1. After the Do Until, add a Send an email action and provide the below parameters:
    • To: Author Email (from Get file properties: Created By Email)
    • Subject: Your document has been reviewed
    • Body:
Hi @{outputs('Get_file_properties')?['body/Author/DisplayName']},

Your document "@{outputs('Get_file_properties')?['body/{Name}']}" has been reviewed.

You can now check the comments and proceed.

Thanks,
Power Automate System
Power Automate Do Until

Now save the flow and test it once. For testing purposes, I changed the delay action count to 2 minutes.

Go to the SharePoint library and add a file; then, leave it for 5 minutes.

do untill Multiple Conditions in power automate

Every two minutes, the manager will receive an email.

Using Do Until in Power Automate

Then, the manager modified the status to ‘complete’ and added a comment.

Add Multiple Conditions in Power Automate Do Until Action

Next, the person who uploads the file will receive an email like the one below:

Power Automate Do Until Action Add Multiple Conditions

To learn about Power Automate’s delay until a specific time, refer to the tutorial below.

Conclusion

In this Power Automate tutorial, we explored how to use the Do Until loop effectively and how to control its execution with count, timeout, and custom conditions.

I hope you now clearly understand how to configure and use the Do Until loop in Power Automate.

You may like the following tutorials:

Leave a Comment

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App