cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frog64
Helper II
Helper II

Do until doesn't work: only first loop works

Hi,

 

I am creating a flow that notifies each person of the hierarchy when someone creates a PO in D365 Finance and Operations.

Here is my example:

  1. The orderer's position is Consultant 1
  2. He reports to Manager1 (called, Mana Ger1)
  3. This manager reports to Director1 (called Direc Tor1)

 

I try to make a 'Do until' loop, to search each time the manager and send him a message on Teams, but only the Manager1 is reached, the loop doesn't go for the Director1, whereas the variable I use is well initialized for that.

Here are printscreens for that flow:

11001.png

As you can see, the flow is on success:

1101.png

For the first step, the Manager1 is well found:

1102.png

111.png

At the end of the loop, the variable is initialized with the good value 'Director1':

112.png

And the variable for the loop is also well set with the value ok...

So I don't understand why the flow doesn't go for an other loop with these values...

 

Can someone help me on this?

Thansk in advance!

 

 

 

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
tom_riha
Super User II
Super User II

Hello @Frog64 ,

The 'Do until' condition tells the action when to stop. In your case it's defined in a way that it should 'Do until VarLoop is equal to ok'.

If you set the VarLoop to 'ok' in the first run then in the next run the 'Do until' will check the condition: it's true (VarLoop is equal to 'ok'), move out of the 'Do until'. You should set it to 'ok' only when you want to leave the loop, or change the 'Do until' condition.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

yashag2255
Dual Super User II
Dual Super User II

Hi @Frog64 

 

The do until will only run the iterations based on the value in the variable that you have set. In the flow run, it shows that the no branch has run and the value was set to ok. This means that the do until has found the variable value as ok and it will stop executing now. 

 

In the edit mode, I can see that in the condition you are checking that the variable value is equal to and there is no value in the right side box. Is this how you want it to be? If you are checking that the variable value is blank, you can use the empty function around the variable and check if that is true. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

3 REPLIES 3
tom_riha
Super User II
Super User II

Hello @Frog64 ,

The 'Do until' condition tells the action when to stop. In your case it's defined in a way that it should 'Do until VarLoop is equal to ok'.

If you set the VarLoop to 'ok' in the first run then in the next run the 'Do until' will check the condition: it's true (VarLoop is equal to 'ok'), move out of the 'Do until'. You should set it to 'ok' only when you want to leave the loop, or change the 'Do until' condition.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

yashag2255
Dual Super User II
Dual Super User II

Hi @Frog64 

 

The do until will only run the iterations based on the value in the variable that you have set. In the flow run, it shows that the no branch has run and the value was set to ok. This means that the do until has found the variable value as ok and it will stop executing now. 

 

In the edit mode, I can see that in the condition you are checking that the variable value is equal to and there is no value in the right side box. Is this how you want it to be? If you are checking that the variable value is blank, you can use the empty function around the variable and check if that is true. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Frog64
Helper II
Helper II

Thanks for your help!

Helpful resources

Announcements
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

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (50,899)