I would like to be able to +1 to a value in an existing field once the flow has run so I can prevent it from looping everytime it's modified but I can't figure out the expression. It's probably very simple but I'm just going in circles at the moment so any help would be greatly appreciated!
Hi @ TomGothard1992,
Could you please share a screenshot of the configuration of your flow?
Could you please share more details about the value in an existing field that you want to add 1? Does the existing field is a field in your sharepoint list?
If the existing field is a field in your sharepoint list, what is the type of the field in your sharepoint list? Is it a Number type of column?
Could you please explain more about "+1 to a value in an existing field once the flow has run so I can prevent it from looping everytime it's modified" that you mentioned?
For you question to add 1 to an existing field, I have made a test on my sideand create a sharepoint list with a number type of column "number".
You could create a flow refer to screenshot below to:
The expression in the "numder" field of "Update item" action as below:
When an item is created or modified, and you could check the value in the number column, if the value in the number column is equal to 0, the flow would add 1 to the value in the number column in the list, the flow would run successfully as below:
Thanks for your response it has worked in preventing the flow from looping. The only issue is that (I'm assuming) now it doesn't loop, and therefore fails, it doesn't actually update the original item. Any help would be greatly appreciated.
I've attached the images below as I couldn't work out how to screenshot them in here.
You could do a Do Until action that checks whether the Modified action is equal to true.
So something like this:
*Note: You have to use an expression to set the value True. Otherwise it will always return false.
See the attachments for screenshots to understand it better.
Hope this helps
Do you want to prevent the start an approval action from run twice when you use the trigger "When an item is created or modified" and you would update the item in the flow?
You could take a try to add a choice type column in your sharepoint list named "modified by flow" with to chlice "Yes"and "No", and set the default value to No.
When the uer create or update an item in the shrepoint list, he should set the "modified by flow" column to "No".
And in the "Update item" action of the flow, set the "modified by flow" column to "Yes".
So you could prevent the start an approval action from run twice by add a condition under the trigger to check if the value of "modified by flow" column is equal to Yes.
If the "modified by flow" column is equal to Yes,do nothing, if the "modified by flow" column isn't equal to Yes, do something you want.
I have tried this and whilst it does prevent it from looping, it results in the flow failing and therefore not actually updating the item at all.
I'll add some more screenshots, can you advise further or test it at your end?
Could you please share a screenshot of the error when the flow run failed?
Or could you please share more details about the error?
Which action run failed when the flow runs?
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!
We've given our badges an overhaul and also added some brand new ones!
Learn how to build the business apps that you need.
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!