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

do until loop runs only once

Hi everyone,

 

i have a problem, that my do until loop runs only once.
The concept is that flow starts at task item created, then send an e-mail with options to assigned people to complete the task from mail. But people can also complete the task form sharepoint, and in this case I want to terminate the flow, becaose it does not have to wait for the response from email.

 

In paralell branch is a send e-mail with options and a do until loop that cheks if the task still exist and it is not completed:
image.png

 

Here you can see, that the loop ran only once, the response to the mail was 13 minutes after.
runrun

Why the loop runs only once?
Is there an other way to stop the flow to waiti to the email response?
After the response is a check that the task is alredy completed or not, but without the email response the flow will never end with the other branch?

 

Thanks for any advice.

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User III
Dual Super User III

I think you may want the condition in your doUntil loop set to be equal to True, not False.  You pre-set it to False which means unless something inside the Loop changes the value of the variable the Loop will only run once. Normally you use a control variable in a Loop by pre-setting it to the value that will keep the Loop running.  Then when you want to exit the Loop you change the value of the control variable.  You're treating this like a Do While Loop rathter than a Do Until Loop.



-------------------------------------------------------------------------
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 III
Dual Super User III

It looks from the screenshot like you've adjusted the run after settings for some of the controls in the loop.  What are they set to?  In terms of the loop only running once.  There is a set variable in the main branch of the loop that sets the control variable to true.  If that runs the first time then the loop will only run once.  That's one of the items that has configured run after settings.  So you need to make sure the only set variable that is running is the one in the condition.



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

The first "set variable" is runnig if the get item fails (if item deleted),

the condition after is runnig if the "set variable" is skipped ("get item" success)

In this case the condition was false, all of the "set variable" actions were skipped.
image.png

Dual Super User III
Dual Super User III

I think you may want the condition in your doUntil loop set to be equal to True, not False.  You pre-set it to False which means unless something inside the Loop changes the value of the variable the Loop will only run once. Normally you use a control variable in a Loop by pre-setting it to the value that will keep the Loop running.  Then when you want to exit the Loop you change the value of the control variable.  You're treating this like a Do While Loop rathter than a Do Until Loop.



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

You were right, I thought it's working like a do while loop.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

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!

Top Solution Authors
Top Kudoed Authors
Users online (7,139)