Flow when a SharePoint Column is updated

In Microsoft Power Automate, you can create a flow that can take action based on specific columns being updated in SharePoint!  This can be done on a list or library.  There is an action called Get changes for an item or a file, which gives you a boolean for each field, whether it was just changed or not.

Here’s how to use: Get changes for an item or a file

In my example, I have a list of projects, and I only want the project completion email to be sent when someone changes the project status column to completed.

First of all, these steps assume that you have prior SharePoint and Power Automate knowledge.  Here are my classes if you’d like to ramp up.

1.  Make sure that versioning is turned on in your list or library. This can be found in the versioning settings in the list/library settings.

2.  Create a new flow.  Use the trigger called When an item or a file is modified. Pick your site and list.
sharepoint-when-file-item-modified-trigger

2.  Add the action called Get changes for an item or a file (properties only).

3.  Pick your site and list.  For the ID field, pick the ID from the trigger.

4.  There is a box called “Since”.  This lets you tell the workflow which changes to compare.  If you want to know which fields have been changed since the item was first created, you’d just type 1.0 in this box.  But in this example, I want to know what just changed in this item, so I’m going to subtract 1 from whatever the current version is.  Use the following expression using the expression builder.  The int fuction ensures that you’re looking at the version number as an integer, and sub does the subtraction.

sub(int(triggerOutputs()?[‘body/{VersionNumber}’]),1)

sharepoint-get-changes-for-an-item-or-a-file-action-flow

5. Since I specifically want to know if the status has just been changed in this latest modification, I can use a condition to check that.  My column is called project status, so I select Has Column Changed: Project Status and is equal to, true.

has-status-column-changed

6.  Now what would you like to happen if the status has just been changed?  That part is up to you.  Maybe you need to send an email or create a task, whatever your business process requires.  Put these next actions in the If yes section after the condition.

BONUS

If you would like to narrow down when your flow gets triggered, and set it up to not even trigger at all if it doesn’t have a status of completed, that can be done as well, in addition to the steps you added above.  Go to the trigger’s settings.

flow-sharepoint-trigger-settings

Add a trigger condition, here at the bottom.  You can see here that I’ve written an expression that is a filter.  Therefore, the flow won’t trigger at all unless the project status is completed.  Then, once it triggers, the condition in the workflow looks to see if the status was just changed in the modification.

flow-trigger-settings-trigger-condition

To learn more about flows with Power Automate, and details about triggers, check out my course on my training site at IW Mentor.

35 comments

  • Funny you should post this now. I just watched a video on this same subject in the corporate site of the company I do work for! While the video was helpful, I appreciate your post as something I can refer back to (and probably will) when this subject comes up again. Thanks Laura!

    Like

  • Ran across your video when you created a flow to pull the Employee Directory into a SharePoint list – It grabbed all direct reports – it’s exactly what I am trying to accomplish. The only issue I am having is how to get the employee photo and I can’t seem to find anyone who can explain how to do this action. I thought you said in the video that it was doable – can you point me in the right direction? Thanks much! Robin

    Like

  • Thank you! Works great 🙂

    Like

  • Hi, Not sure what i’m doing wrong but when i enter “sub(int(triggerOutputs()?[‘body/{VersionNumber}’]),1)” as an expression in the “Since field” i get an error “The expression is invalid”. I pasted it direct in. Thanks

    Like

  • rajesh goud merugu

    Hi, Not sure what i’m doing wrong but when i enter “sub(int(triggerOutputs()?[‘body/{VersionNumber}’]),1)” as an expression in the “Since field” i get an error “The expression is invalid”. I pasted it direct in. Thanks

    Like

  • Thanks all for the help

    Like

  • Excellent tutorial, thank you Laura.

    Like

  • Awesomeeeee! you are the BEST ♥

    Like

  • Hello, your post is very helpful. Is working great on updates. However, when I create a new record, I’m getting an error: Specified Version Label does not correspond to any actual version. Any ideas?

    Like

    • Only run the flow on modified items, not new ones. My post says to trigger on modified. If you were going to run one when it’s new, you’d have to create a different flow that compares it to version 0 instead of trying to get a previous version.

      Like

  • Pingback: SharePoint PnP Dev General SIG Call – Oct 15th, 2020 – Screenshot Summary - Warner Digital

  • Hi Laura,
    I get this error: “the template language function ‘int’ was invoked with a parameter that is not valid. The value cannot be converted to the target type”. Could you please advise?
    Regards,
    Daniel

    Like

  • Any particular parameter that needs to be within the list or can’t be so it won’t block the flow? I suppose that target type is the VersionNumber in this case, but I don’t understand why it says that the parameter is not valid. Everything is per your guidance. 😦

    Like

  • Laura, now I get this error: Specified Version Label does not correspond to any actual version. Any thoughts?

    Like

    • Sorted! The first problem was connected with “apply to each”- I deleted the flow and created a new one.
      Second issue was resolved by including minor version in ‘Get changes from…’ step. 🙂
      Thank you for this article. Very helpful. Much appreciated.

      Like

    • That will happen if either versioning isn’t turned on, or it’s the very first version (on create).

      Like

  • Hello Laura,
    With your above solution, everything works fine. But when the column is modified with an attachment added in the same modification, sharepoint list is making 2 versions, one with column modification and one with the attachment (very annoying), this has as a result that the above modification does not work because of the extra attachment versioning. Do you have any idea about that?
    Thanx!!!

    Like

  • However I have another problem with conditioning workflow to trigger only for desired status. Should I put different name for my list item? You put Project_x0020_.

    Like

  • Thank you so much for the great post, is there a way to trigger a flow when a file is created or modified, but based on version?I don`t want the flow to run on minor versions, Also I have this issue that when flow runs for approval – on publishing a major version, each time that flow runs on the file it adds a minor version to the file 😦

    Like

  • Hi Laura, I tried your flow but unfortunately, when inserting the function “sub(int(triggerOutputs()?[‘body/{VersionNumber}’]),1)” I have an error message “The expression is invalid”.
    Any advice on this?

    Thanks

    Like

    • Found what the issue is… the brackets are not same (probably linked to geographical parameters). Yours are ‘ and I should use ‘.
      Différence is small but seems Sharepoint makes the point.

      Like

    • Don’t copy and paste, the quotes end up weird. Type them from scratch.

      Like

  • Hello Laura, thanks so much for this post. It got me one step closer to what I need. There is one final step that I would like to achieve and I have wrecked my brains on how to go about it. There is an additional possibility in my scenario where the column being referenced to check that the item has been modified (which will then trigger an email), is modified again. When the item is first created this column is empty.
    My problem is that I only want to send this email once i.e. as long as the column in the previous version is empty. After that if this column is modified again then the mail should not be sent.
    For added info the column I’m referring to contains a time value. Is this possible?

    Thank you in advance.

    Daniel

    Like

  • THANKS !!!!!!!!!

    Like

  • Your article helped me break through the wall on triggering flows based on changing a status. HUGE THANK YOU!

    Like

Leave a reply or question

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.