cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
livingstonep
Level 8

How to break out of a Do.. Loop with a Delay

Hi,

 

We have a flow with several sequential approvals (by different teams) and need to implement Reminder emails every 7 days so the approvals don't time out...

 

So I created a Parallel Branch for my first approval, and added a Do...Until with a condition of an integer variable being =1 will end it...

 

Inside the Do..Until loop I added a Delay step for 7 days to send the reminder email every 7 days...

 

here are some images:

MS Flow Reminder Parallel Branch 7 Days issue.PNGMS Flow Reminder Parallel Branch 7 Days issue 2.PNG

The issue is that if the approvers approve (or reject) the item before the 7 days are up, we still have to wait for the Delay step to complete it's 7 days before the next approval can be started...

 

so is there a workaround for that?

 

We can't have less than 7 days, but if the approval is completed we don't want to wait for 7 days...

 

Is there a way to break out of the Do...Until ?

 

Or do I have to have a delay of 1 day run 7 times, incrementing an integer by 1 each time and only sending the email when it's =7 then reseting it to 1?

 

thanks

Philip

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: How to break out of a Do.. Loop with a Delay

Here's a rough prototype of what I was suggesting.  The first screenshot shows the overall flow.  I initialize two variables at the top, one to control exiting the loop after the approval returns and the other to control when to send reminders inside the loop. The second screenshot shows the details of the loop.  I've got it set to loop every 10 minutes and send a reminder every hour.  So it delays for 10 minutes, increments the counter and checks to see if 6 loops have passed (60 minutes).  If they have it sends an email and resets the counter.  Otherwise it does nothing.  When the approval returns and sets the control variable to true it exits the loop.

screenshot.jpg

screenshot.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
Dual Super User
Dual Super User

Re: How to break out of a Do.. Loop with a Delay

There is no way to break out of a Loop.  What you could do is decrease your delay to something like one day and then add a counter and only send the reminder if the counter reaches 7.  That way the loop will cycle every day, but only send the reminder on the seventh day.  But then you could exit the loop at the end of each day when the loop cycles.  If you want it more frequent than that just decrease the size of the delay even more and up the value of the counter.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
livingstonep
Level 8

Re: How to break out of a Do.. Loop with a Delay

@Pstork1 

 

Thanks, I have tried this, but having no luck - the delay timer passes without sending a reminder.

 

Here are the images showing the two parallel branches:

Flow Delay Issue 1.PNGFlow Delay Issue 2 - Reminder Parallel Branch.PNGFlow Delay Issue 2 - Approval Branch.PNG

 

Here you can see it has passed the 10 Minute Delay

Flow Delay Issue 2 - Reminder Parallel Branch passed delay.PNG

is there something wrong with my Do...Until or Delay steps?

Highlighted
Dual Super User
Dual Super User

Re: How to break out of a Do.. Loop with a Delay

Here's a rough prototype of what I was suggesting.  The first screenshot shows the overall flow.  I initialize two variables at the top, one to control exiting the loop after the approval returns and the other to control when to send reminders inside the loop. The second screenshot shows the details of the loop.  I've got it set to loop every 10 minutes and send a reminder every hour.  So it delays for 10 minutes, increments the counter and checks to see if 6 loops have passed (60 minutes).  If they have it sends an email and resets the counter.  Otherwise it does nothing.  When the approval returns and sets the control variable to true it exits the loop.

screenshot.jpg

screenshot.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Community Support Team
Community Support Team

Re: How to break out of a Do.. Loop with a Delay

Hi @livingstonep 

 

Has your problem been solved?
If your problem has been solved, You could go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

Best Regards,
Community Support Team _ Lin Tu

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (3,800)