Sunday, May 20, 2018

Microsoft Flow - Mystery of Do Until loop

Building solutions based of Microsoft Flow some times remind me of orchestration products.

If you follow the logical approach you can do wonders and automate many things using Microsoft flow.

This week I was working with one of the flow automation where I had a need to use DO UNTIL loop but  I was not successful unless number of tries and research on internet so want to share the learning on how to make DO Until to work correctly.

Few things to make DO UNTIL to work.

  • Do not use Blank value

  • Status is equal to CheckPassed means that until the value gets equal to Check passed keep on Running.(This is where many users on the Internet got stuck as DO UNTIL was not working because they were just setting the Status value in the list to the value they have defined in the loop statement where as its other way round that it should not equal to that value to make it running)

  • Add delay as per your requirement.

  • Get-item is used to refresh list value from SharePoint.(i.e. get new value) -- This is the second important point to always use refreshed value

  • Status that is used in DO UNTIL should be from Get-item that you have added in DO UNTIL function. -- This is the last important point to take care of.

There are other things to take care with this loop:

  • By default DO UNTIL iterations are 60 and time out is 1 hr.

  • You can change that by clicking Change limits.

  • Count can be changed to max 5000 iterations.

  • You can change the PT1H to PT24H i.e. 24 hrs or PT72H means 72 hrs.


If you follow this approach than your DO UNTIL loop will work correctly.

Thank You for reading

Sukhija Vikas


  1. Hi Vikas,
    Thanks for sharing this. I am trying to implement the solution but getting it wrong somewhere. I have used email before and after do until and I do a one minute pause in Do until. Get items is on the same library.
    I am not able to share a screen shot with, let me know if I can share the screen shot to let you know the exact configuration of the Flow.
    Thanks in advance for the help.

  2. Yes Share the flow, I will see where it is geeting wrong..

  3. My DoUntil starts with checking for a variable 'x' status. Once the status is changed from 0 to 1 the DoUntil should stop. I can't use GetItem since it utilize sharepoint while mine compares with variable created inside the Flow.

    any ideas?

  4. […] Go to Article Posted: 12th November 2018 7:04 pm Author: Vikas Sukhija […]

  5. Hi bro. I try to do a "Do until" but I'm getting 2 email sent at the same time?

  6. please share the flow than I can see whats wrong with it..

  7. i dont understand what the "count" means for the flow

  8. Its iterations of do until loop limit before it fails (maximum 5000)

  9. Livinus Ifeanyi IkeOctober 4, 2019 at 1:03 AM

    Hi Vikas, please let me know what is wrong here.

  10. I am not able to see it on google drive can you share via onedrive ?

  11. Thank you for posting this. I was struggling with Do Untill for a while and your suggestion solve my problem