Run a Flow Only When a SharePoint Item Changes – A Very Simple Solution

I monitor the Power Automate forums on the Power Users Community (https://powerusers.microsoft.com) site very closely. I frequently see community members ask how they can have their Flow run only when a SharePoint list item has changed. The problem is that there is no trigger that fires only when an item has changed. There is a trigger that fires when an item has been created and when it has changed, but not only when it has changed. Many of us have created SharePoint Designer workflows in the past and got used to having the ability in Designer workflows to run a workflow only when an item has changed.

Please note that the obvious solution is to compare the created and modified dates and times.  If they are the same then it is a new item.  The issue is that, believe it or not, the created  and modified date and time may not be the same for a new item.

I have developed a simple solution to this issue based on version numbers. The expression that you’ll see at the end of my example simply compares the version number from Dynamic properties to 1.0. If the version is anything other than 1.0 then it is not a new item and your Flow will run.

Here is a very simple solution to this issue:

  1. Turn on versioning in the list if it is not already turned on
    1. Go to list settings and click on Versioning settings VersionLink
    2. Set the answer to “Create a version…” question to Yes image002
    3. Create a Flow that starts with a SharePoint “When an item is created or modified” trigger.
      1. Click on the ellipses in the top right corner of the trigger an then on settings StopChangeSettings
      2. Go to the Trigger conditions section at the bottom of the configuration screen and click on “Add” AddTrigger
      3. Paste the following into the text box and click on “Done”
        1. @not(equals(float(triggerBody()?[‘{VersionNumber}’]),1.0)) AddTrigger2
          1. PLEASE NOTE THAT THE QUOTES AROUND VersionNumber MUST BE SINGLE QUOTES.  THEY MAY NOT PASTE AS SUCH WHEN YOU COPY AND PASTE THE EXPRESSION.  IF YOUR EXPRESSION DOES NOT VALIDATE, CHECK TO BE SURE THAT SINGLE QUOTES HAVE BEEN USED.  YOU MAY NEED TO DELETE AND RE-ENTER THEM AS SINGLE QUOTES.  ALTERNATIVELY, ENTER THE EXPRESSION MANUALLY.
      4. Save and test your Flow by creating and editing list items. Your Flow should run only when and item has changed.
      5. That’s it!

2 thoughts on “Run a Flow Only When a SharePoint Item Changes – A Very Simple Solution

  1. Hi Scott – I’m trying to save this and am getting the following error. Can you assist?

    Fix invalid expression(s) for the input parameter(s) of operation ‘When_an_item_is_created_or_modified’.

    I can’t figure out how to post an image in this comment.

    Like

    1. Hey Mary, you need to replace the single quotes from when you copy and paste. They copy over in a weird format.

      Like

Leave a Reply

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