Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Do While Loop Does not work - Approval Action

(0) ShareShare
ReportReport
Posted on by 4,795

I am desigining a flow where I need to assign a task to approver. Then If approver Rejects the task, it should go to submitter. Now If Submitter approves the task, it should goes back to approver. Loop should quit if approver approves the task or submitter rejects the task.

 

I have put together a flow using do while but it does not loops back at all. It just ends after 1st cycle is executed. I have checked lot of threads on this topic but loop just doe snot work.

 

Flow is as below...

 

Do While - variable loopback = 'loopback'

Start an approval

Condition - ResponseStatus = Reject

If Yes - Start an approval

Condition - ResponseStatus = Reject

If Yes --> Set variable loopback = 'noloopback'

If No --> Set variable loopback = 'loopback'

 

  • LeeHarris Profile Picture
    1,026 on at
    Re: Do While Loop Does not work - Approval Action

    Hi @PrasadAthalye

     

    The approval shouldn't expire within that timeframe. If approvals are meeting the criteria that causes them to loop through the process again though you will need to be mindful of the timeout value in the Do Until loop (which I think you have set at the maximum 30 days).

     

    You can refer to https://docs.microsoft.com/en-us/flow/limits-and-config#run-duration-and-retention for more information. Regarding Approvals, the run duration of a Flow is 30 days. Includes workflows with pending steps like approvals. After 30 days, any pending steps time-out. Timed-out approvals are removed from the approvals center. If someone attemps to approve a timed-out request, they’ll receive an error message.

  • PrasadAthalye Profile Picture
    4,795 on at
    Re: Do While Loop Does not work - Approval Action

    Thanks a Lot. Works like Charm. Actually I got misguided on Do Until. We are so much used to Do while :)... So condition has to be otherway. 

     

    Just one more question... Do you think this setting will still work if approver approves after say 2 days? I mean will the approval request expire? I have SLA of 4 days max for approvers and they can delay the approval... 

  • Verified answer
    LeeHarris Profile Picture
    1,026 on at
    Re: Do While Loop Does not work - Approval Action

    Hi @PrasadAthalye

     

    It looks like you need to change the value in your Do Until loop from "loopback" to "noloopback". There is no need to set the variable to loopback each time you want to loop again, you just need to set to noloopback when you want to exit the loop.

     

  • PrasadAthalye Profile Picture
    4,795 on at
    Re: Do While Loop Does not work - Approval Action

    Thanks for the response. But it does not work. I changed to max retries 5000 and timeout seeting as you requested. But it just does not execute the loop again and flow ends. 

     

    Also I am trying to understand what 5000 retries means? I am approving within 2 mins. Does it already have executed 5000 times? 

    FlowDoWhile.PNG

  • LeeHarris Profile Picture
    1,026 on at
    Re: Do While Loop Does not work - Approval Action

    Hi @PrasadAthalye

     

    Depending on how quickly you are are Approving/Rejecting the requests, this could be caused by the timeout property of the Do Until loop. By default this is set to 1 hour.

     

    There is a similar post here that was resolved by changing the Timeout value to PT720H (30 days) and max retries to 5000.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow