cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Martin_MC
Level: Powered On

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
Martin_MC
Level: Powered On

Re: Do Until Not Null Issue

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

Re: Do Until Not Null Issue

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

Martin_MC
Level: Powered On

Re: Do Until Not Null Issue

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.

Dual Super User
Dual Super User

Re: Do Until Not Null Issue

Hey @Martin_MC 

 

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!

Super User
Super User

Re: Do Until Not Null Issue

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

Martin_MC
Level: Powered On

Re: Do Until Not Null Issue

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)

Dual Super User
Dual Super User

Re: Do Until Not Null Issue

Hey @Martin_MC 

 

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!

Super User
Super User

Re: Do Until Not Null Issue

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.

 

Super User
Super User

Re: Do Until Not Null Issue

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

Martin_MC
Level: Powered On

Re: Do Until Not Null Issue

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

Helpful resources

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

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 (Last 30 Days)
Users online (5,543)