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

Adding 1 to an existing field once the flow has run

Hi,

 

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!

 

Thanks!

6 REPLIES 6
Community Support Team
Community Support Team

Re: Adding 1 to an existing field once the flow has run

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:

Capture.PNG

 

 

The expression in the "numder" field of "Update item" action as below:

add(triggerBody()?['number'],1)
 
You could refer to link below to learn more about the workflow definition language 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:

Capture.PNG

 

 

 

 

 

Regards,
Alice Zhang

TomGothard1992
Level: Powered On

Re: Adding 1 to an existing field once the flow has run

Hi Alice,

 

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.

 

https://imgur.com/jX8vk4P

 

https://imgur.com/ZtikjGU

 

https://imgur.com/a/eXBzm

 

https://imgur.com/a/AQn8S

Super User
Super User

Re: Adding 1 to an existing field once the flow has run

Hey @TomGothard1992

 

 

 

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

 

 

Kind regards

 

Tom

 





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Community Support Team
Community Support Team

Re: Adding 1 to an existing field once the flow has run

Hi, @TomGothard1992

 

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.

 
 

 

Regards,
Alice Zhang

TomGothard1992
Level: Powered On

Re: Adding 1 to an existing field once the flow has run

Hi Alice,

 

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?

 

https://imgur.com/dXeCZIA

 

Approval

 

Modified Flow

 

Kind regards,

 

Tom

Community Support Team
Community Support Team

Re: Adding 1 to an existing field once the flow has run

Hi @TomGothard1992,

 

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?

 

 

 

Regards,
Alice Zhang

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 (3,941)