cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PrasadAthalye
Super User
Super User

Do While Loop Does not work - Approval Action

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'

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community
1 ACCEPTED SOLUTION

Accepted Solutions

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.

 


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

View solution in original post

5 REPLIES 5
LeeHarris
Solution Sage
Solution Sage

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.


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

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

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

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.

 


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

View solution in original post

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... 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

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.


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (26,790)