cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Do Until Not Null Issue

Hi.

 

So I have a multi-approval flow with a SharePoint list as the basis, and at the current point in the flow it needs to go to a Payroll Manager, who then needs to make a selection as to who the actioning Payroll Officer should be. I’m not sure if it’s possible to send a dropdown box to the manager for them to simply select a user via email or adaptive card and so I thought a much simpler option would be to run with a:

 

Send Email (to Payroll Manager) > Do Until (Payroll Officer column does not equal NULL) > Update Item (with next status for switch case)

 

At which point the switch would recognise the change in status, and send the Payroll Officer their instructions.

 

However I’ve tried this a few times and the Do Until doesn’t seem to move on at all, even when the manager goes to the SharePoint list and selects an officer from the Payroll Officer column (making that column no longer NULL).

 

A point to note: The flow trigger is ‘When SharePoint item is created or modified’ but I have a version-comparing filter in place in order to stop the flow from sending out all of the various emails when an attachment is attached, because this can happen at any time. The way this works is it checks the ‘Status’ column and the ‘Comments’ column, and if they have not changed, then ignore that trigger. My assumption is that this shouldn’t affect the flow at this current point, because while it may trigger (and terminate) a new flow when the Payroll Officer is selected, the pre-existing flow should still be running and should still be checking for that Payroll Officer value.

 

Can anyone suggest the best way, or even just a functional way of making this work? Whether that be something I’ve missed in the Do Until, or a suggestion on another way for the Manager to make the PO selection.


Thank you.


A brief snapshot of this switch case and the Do Until:

PO1.pngPO2.png

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Will need to run another couple of tests but think I have it working now - the visuals help a lot, so thanks for that. And thank you all for the above help! Appreciated.

View solution in original post

9 REPLIES 9
Gristy
Resident Rockstar
Resident Rockstar

rather than looping i would recommend making a 2nd flow with the required logic that runs each time the item is modified, but with a conditional start trigger i.e. @not(equals(condition))

Anonymous
Not applicable

Conditional triggers are not something I've touched on much but if there's no (relatively simple) way of making it work within the existing flow then I guess that's something else I'll need to look into.

Hey @Anonymous 

 

You will have to add the Update Item and the Delay actions in the Do Until loop itself for this to work. Note that the Do until loop will look for the value within its range only and then move to the next step. If this does not match the scenario you are building, you can always use variables. Initialize a string variable and assign some value to it. and after updating the item (within the loop) set the variable to the value that you want to check for null. (Makes Sense?)

 

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!

Your current configuration has several issues.

 

1) you are using Get Items, you should use Get Item and pass the ID from the trigger as you already know this.

2) you should have a variable to do the loop on i.e. varStopLoop default - false

3) you should then evaluate the field value from the Get Item action and set varStopLoop to true in the yes condition branch.

4) in the no condition branch you should add a delay i.e. 4 hours, 1 day or whatever is appropriate otherwise the loop will run 5000 times pretty fast and then just stop

Anonymous
Not applicable

Okay so placing the Delay and Update into the Do Until did actually work in the sense that the list updated, where it wasn't before; so thanks for that @Yash . However now it's just going round and around, continuously updating. Surely "Do Until" means do this until the conditional set is no longer true? IE in this instance, as soon as the Payroll Officer column contains data, it should move on? How do I make the Do Until stop once the field as been achieved; the flow should stop / move on at that point.

(Note that I am very new to flow and have dove straight into the relatively deep end - apologies)

Hey @Anonymous 

 

Yeah so as mentioned in one of the other resposnes, are you trying to update each and every item in the sp list based on the switch case value? If so, the flow will keep running until that item is null (but it will not work in our case as there is a referencing issue here). What you need to do is initialize a string variable and assign some value to it. Now in the do until loop, set the loop to check the value of this variable and then in the do until loop, after updating the action, add a condition to check if the desired state is achieved and if so, set the variable to the value as mentioned in the Do until loop and in the no branch add any other value (to set the stop condition for the loop)

 

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!

You need to use a variable, not a dynamic data from your trigger.

 

the dynamic data will not change, it is the value as when the trigger was hit.

 

Gristy
Resident Rockstar
Resident Rockstar

here is a example of what is required - obviously the condition and get item query need work/proper data but apart from that the logic is there.

Annotation 2019-10-22 213435.png

Anonymous
Not applicable

Will need to run another couple of tests but think I have it working now - the visuals help a lot, so thanks for that. And thank you all for the above help! Appreciated.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,510)