cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Do until loop not working

Hi all, 

I am trying to build a flow for this process: When a service request is submitted, if it is in Top priority, it needs to be fixed in 15 mins.

 

After 15 mins, if the case is still not closed, send an reminder email to the staff (1st reminder).

After the 1st reminder is sent, the staff will receive reminder email every 5 mins until status changes to Closed.

 

Here's my design, the problem is: Using Do until, email will be sent before checking the condition inside the loop. I think a do while loop might be more suitable but no idea how to build. Any help?

 

msflow_SR.jpg

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

 

Hi @leungar2 ,

 

The first method is to use the Delay action for five minutes after sending the reminder for the first time and then use the Get item action to get the current status value and assign the value to the variable.

Then add Condition to Do until, if the variable value is Closed, then the following action is not performed.

 

The second method is to add a reminder statement in the email, telling the user to ignore the email directly if the relevant operation has been completed.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Resident Rockstar
Resident Rockstar

The status Value you are using in the do until, is not the value from the Get Items - this is outside of the context.

 

Use a variable instead and update the variable after the get items with the latest value.

 

i.e. create a variable, use that in your do until and then if the value is what you need, update the value of the variable to break the loop

 

Hi @Gristy 

 

What do you mean by "not the value from the Get Items"? The status value is from "Get item 2"

 

ms flow sr.jpg

 

Resident Rockstar
Resident Rockstar

hover over the Status value, it will no way be Get Item 2, as it would never let you save the flow.

 

you need to add a Initlize Variable at the top and a Set Variable under get item 2 to change it if the status value is closed for this flow to work 🙂

Community Support
Community Support

 

Hi @leungar2 ,

 

Your Flow can basically cover your needs, you just need to use variables to store the current status value. And rely on this variable to end the loop.

Image reference:

64.PNG65.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-bacao-msft@Gristy 

 

Thanks so much for your help. I modified the flow a little bit but there's still a problem.

This is my process:

After 15 mins, if the case is still not closed, send an reminder email to the staff (1st reminder).

After the 1st reminder is sent, the staff will receive reminder email every 5 mins until status changes to Closed.

 

The problem now is: Reminder1 and Reminder2 will be sent out at the same time, seems Do until will do actions before checking the condition. Any thoughts?

 

sr_flow_v1.jpg

 

Hi @leungar2 ,

 

The first method is to use the Delay action for five minutes after sending the reminder for the first time and then use the Get item action to get the current status value and assign the value to the variable.

Then add Condition to Do until, if the variable value is Closed, then the following action is not performed.

 

The second method is to add a reminder statement in the email, telling the user to ignore the email directly if the relevant operation has been completed.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

No, it is your logic.

 

You do not need reminder1 at all. If you do want to keep two seperate emails then move the delay above reminder2.

Hi @Gristy , @v-bacao-msft 

 

Thank you all for your help! It's now running good! In case anyone got similar problem, below is the full flow for your reference

 

ohkb_full_flow.png

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (67,033)