Skip to main content

Notifications

Check for a Change in a SharePoint List Column Value

I've seen frequent posts in the Flow Forums from users asking how they can check for a change is a specific column in a SharePoint list,  If the value has changed, they want to take some type of action.  I have usually answered these questions by saying that this is not an "out of the box" Flow feature.  There actually is a way to check for a change in a SharePoint list column value and it isn't very difficult to implement.  It does involve calling a SharePoint web service, but I'll show you exactly what you need to do.

 

First, let me set some parameters:

  • I am assuming that you have versioning turned on and set to major versions.
  • I am assuming that you are checking values in a list and not a library
    • This Flow would need to be slightly altered to use with a library

Step one is to create a Flow that uses the SharePoint "when an item is created or modified" trigger.  Since this Flow checks for changes in a column value, it doesn't make sense to run the Flow on a new entry.  The first part of my Flow checks to see if the created date and time is the same a the modified date and time.  If they are the same, then this is a new item and the Flow exits with a Control Terminate action.

 

VersionNewChange.jpg 

Please note that the Terminate action status is set to Succeeded - the default is Failed.  If you don't change the status to Succeeded, your Flow will show as failed when a new item is created even though it ran as designed.

 

Next, I set a variable that holds the list item ID.  I'll use this variable when I call the SharePoint web service.   

 

VersionVariable1.jpg 

 

Now for the good stuff - next I call the SharePoint Web service.  I use a "Send an HTTP Request to SharePoint" action.  The particular API that I'm calling returns all versions of a list item along with all columns and data in those columns.  Configure your "Send an HTTP Request to SharePoint" action in exactly the same way as I have in the screen shot below except:

  • select your own site collection
  • replace VersionTest (the name of my list) with the name of your list inside of single quotes

 Note that I am inserting the variable where we stored the item ID in the web service call.

VersionHTTP.jpg 

At this point, when creating your own Flow, save it and run it by making a change to an item in your list.  Remember that you'll need to have at least 2 versions of an item for your Flow to make it all the way to the HTTP call and we will need information returned by the HTTP call in the next step.

 

After the Flow runs, take a look at the run history and do the following:

  1.  Scroll down to the Send an HTTP request to SharePoint action
  2. Click on Body at the bottom of the action.  Select everything in the Body area and copy it to your clipboard.

 

VersionHTTPCopy.jpg

 

Now, I add a Parse JSON action.  This action enables us to easily use all the data returned by the HTTP action.  

 

ParseJSON1.jpg 

 

In the Parse JSON action content section, select Body from the Send an HTTP request to SharePoint section in Dynamic properties.  Now, click on "Use sample payload to generate schema".   In the dialogue box the appears, paste the data on your clipboard (copied form the HTTP Body section) and click on Done.  This will automatically configure this action to interpret the data provided by the HTTP action.

 

When complete, the Parse JSON action should look like this:

 

ParseJSON3.jpg  

Almost done - all we need to do now is to retrieve the value we are comparing from the previous version of the list item and compare it to the value in the current version. 

 

Next, I create a string variable and initialize it to the value of the column in which we are interested from the previous version of the list item.

 

VersionCompare1.jpg

 

Here's what I have in the expression:

GetData.jpg

Referencing the column name requires a little more explanation.  If there are no spaces in the column name you can probably just enter the column name.  If there are spaces in the column name or you just want to be sure you are using the right name,  go to the Parse JSON action and scroll down in the schema section until you see something that looks like your column name.  Here is a section from my schema that refers to a few columns:

 

VersionColumns.jpg

 

I have a column called MyChoice with no spaces which I can refer to as MyChoice.  I also have a column called My Date.  I need to refer to this column as My_x005f_x0020_x005f_Date.

 

All I need to do now is to compare the current value in the column to value from the previous version (stored in the variable).

 

VersionCompare2.jpg

 

That's it - we have now compared the value currently in a SharePoint column to the value in the previous version of that list item
 
Here is screen shot of my complete Flow:
Complete.jpg
 
Let me add a few final points:
  • When you Flow runs, you might see error messages about data types in the HTTP or Parse JSON actions. If this happens, edit the schema and remove the data type designation from the area where the column is defined
  • I tested this Flow with string, number, choice, person or group, yes/no and text columns
  • To see what data is returned and how it is formatted, refer to the output of the Parse JSON action in the run history
  • Remember to turn on versioning in your list - it is not on by default

I found the following blog post extremely helpful when creating my solution

 

Please comment and let me know what you think.

 

Scott

Comments

*This post is locked for comments

  • Chrisl Profile Picture Chrisl 128
    Posted 16 May 2024 at 20:11:57
    Check for a Change in a SharePoint List Column Value

    Hi @ScottShearer 

     

    How can I message you with regards to a similar flow I am trying to create?

  • RickSavoy Profile Picture RickSavoy 24
    Posted 09 Feb 2023 at 23:17:23
    Check for a Change in a SharePoint List Column Value

    Hi @ScottShearer (or anyone)

    The new screens look a bit different but here's what I have and my problem

    RickSavoy_2-1675985335714.png

    RickSavoy_0-1675984515632.png

     

    And my results

    URI path is not a valid Graph endpoint, path is neither absolute nor relative or resource/object is not supported for this connector. Resources: me,users Objects: messages,mailFolders,events,calendar,calendars,outlook,inferenceClassification. Uri: /_api/lists/getbytitle('BOM Status List')items(4486)/versions

     

    Any ideas what might be happening? Should I be using the numeric list code above instead of the text name?

     

  • tmaccabe Profile Picture tmaccabe
    Posted 07 Dec 2022 at 20:50:39
    Check for a Change in a SharePoint List Column Value

    Comparing a blank string type column to earlier version that was previously blank fails because null != null. Recommend replacing this condition with a couple steps found in Flow when a SharePoint Column is updated - @WonderLaura. She uses Get changes for an item or a file (properties only) followed by a condition checking for Has Column Changed. You solution here is great because the http request gives you the old value, whereas Laura's approach alone does not. Combing steps from both gives both accurate results and more info.

  • dtagliolini Profile Picture dtagliolini
    Posted 26 Jun 2022 at 19:19:20
    Check for a Change in a SharePoint List Column Value

    hello @ScottShearer and @PhilD

     

    I need your help pleeease!

    all good but as expected I get following error, I can't figure out how to remove the data type

    dtagliolini_0-1656270817477.png

     

    dtagliolini_1-1656271100035.png

    Could you please help me? I believe i'm almost there!

     

  • snehabirajdar17 Profile Picture snehabirajdar17 2
    Posted 18 Jun 2021 at 17:49:50
    Check for a Change in a SharePoint List Column Value

    Hi,

     

    I have a question that how to check if any items change in a list in last 24 hours using power automate. 

    How achieve this task please assist.

  • sean-knights Profile Picture sean-knights
    Posted 11 Jan 2021 at 23:37:33
    Check for a Change in a SharePoint List Column Value

    Hi Scott.  You've put me onto a wonderful path with the API, JSON and Flow.  I've implemented this solution very successfully, thanks a million.

     

    Now I have a questions.

    Can I make multiple HTTP calls in a single flow?  For example I've looked up all of the versions of a given order then I get the customer number and now I need to get the contact details for the customer from the related table.  Can I embed the second HTTP posted request within the same flow?  - I seem to be running into trouble when doing so.

     

    How would you suggest I make the second call?  Should I change the reference from [d] to possibly [e]?  

     

    I gather data about the order, then about the customer and then about the responsible employee and then assemble an email that is sent to all relevant parties on the placing of an order.  The fields collected form the foundation of the email body.

     

    Looking forward to your response and wisdom:)

     

    Sean Achim

  • jbrines Profile Picture jbrines 1,103
    Posted 14 Dec 2020 at 16:40:16
    Check for a Change in a SharePoint List Column Value

    @liniv Figured it out missed out the the value in the In Initialize Variable.

     

    All working to that stage, now time to move on.

    Thanks

  • jbrines Profile Picture jbrines 1,103
    Posted 14 Dec 2020 at 16:03:28
    Check for a Change in a SharePoint List Column Value

    @liniv 

     

    Just realised that I wasn't replacing Version Test with my list name đź¤”

     

    Now I have changed that but now I am getting 

     

    Item does not exist. It may have been deleted by another user.
    clientRequestId: 5ce6d186-1de3-408f-adad-62b6305be2d0
    serviceRequestId: 8d42979f-60d8-b000-95f3-76c14dc7f41c

  • jbrines Profile Picture jbrines 1,103
    Posted 14 Dec 2020 at 15:49:35
    Check for a Change in a SharePoint List Column Value

    @liniv 

    Different error this time

     

    Power Automate issue 7.JPG

  • liniv Profile Picture liniv 27
    Posted 14 Dec 2020 at 15:42:35
    Check for a Change in a SharePoint List Column Value

    @jbrines 

     

    in the Uri change the double brackets "ListName" with single 'ListName'. This also may be a problem hence the error is in the expression