web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Increment a column val...
Power Automate
Unanswered

Increment a column value on a SharePoint List

(0) ShareShare
ReportReport
Posted on by

Hello.

 

I need a column called Version #/Version_x0023_ on my SharePoint lists to increment by 1 every time the item is modified. It is working when the user modifies the item once, but not for multiple modifications of the same item.

 

Basically, the flow triggers when an item is created or modified in my SP list. Then, I retrieve the item and create a new item using the same info in another SP list. Then I use a switch action for two cases: when the project status is open and when the project status is modified. The flow is able to change an item's version # from 1 to 2 after the user modifies the item once, but not from 2 to 3 and beyond when the user modifies the item again.

 

I have attached screenshots. The compose action contains the formula "if(equals(body('Get_item')?['Version_x0023_'], null), 1, add(int(body('Get_item')?['Version_x0023_']), 1))". 

 

Screenshot 2024-05-07 094346.pngScreenshot 2024-05-07 094722.pngScreenshot 2024-05-07 094827.png

 

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,181 Most Valuable Professional on at
    Re: Increment a column value on a SharePoint List

    Hi @hhuynhfm,

     

    Out of interest, what is the reason you are not using the out of the box version history but creating your own version history numbering? Do you have a specific requirement that you want to create your own bespoke version number?

     

    Microsoft keeps track of the version history for you by default in your List. You just need to add that version column to your view. Below is an example of that feature.

     

    1. Version history menu item

     

    versionhistory_ecb.png

     

    2. Add Microsoft Version column to view

    versioning_column.png

    3. Example of Version column value

     

    versioning_enabled.png

  • hhuynhfm Profile Picture
    on at
    Re: Increment a column value on a SharePoint List

    Hi @Expiscornovus !

     

    I have tried the versioning column created by SharePoint, but it doesn't work for my purposes because it increments the version number every time I update my file (which is many times throughout this flow) and this creates some confusion about how many times a user has actually changed the item themselves.

     

    My flow creates a new item for every modification made so even if I were to configure the versioning to only create a version each time I edit an item in the list, the version # will only ever show up as 1. Thus, I need my flow to recognize if an item has been modified before and change the version # itself. But thanks for the suggestion!

  • Expiscornovus Profile Picture
    33,181 Most Valuable Professional on at
    Re: Increment a column value on a SharePoint List

    Hi @hhuynhfm,

     

    You can update an item via the ValidateUpdateListItem method. In this method you can use the bNewDocumentUpdate property to make sure your item does not get a new version:

    https://robertschouten.com/2018/04/30/update-file-metadata-with-rest-api-using-validateupdatelistitem-method/

    https://techcommunity.microsoft.com/t5/microsoft-sharepoint-blog/update-file-metadata-with-rest-api-using-validateupdatelistitem/ba-p/1365682

     

    This way you can keep using the system Version column, without incrementing the version via your flow.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard