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:
- Turn on versioning in the list if it is not already turned on
- Go to list settings and click on Versioning settings
- Set the answer to “Create a version…” question to Yes
- Create a Flow that starts with a SharePoint “When an item is created or modified” trigger.
- Click on the ellipses in the top right corner of the trigger an then on settings
- Go to the Trigger conditions section at the bottom of the configuration screen and click on “Add”
- Paste the following into the text box and click on “Done”
- @not(equals(float(triggerBody()?[‘{VersionNumber}’]),1.0))
- 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.
- @not(equals(float(triggerBody()?[‘{VersionNumber}’]),1.0))
- Save and test your Flow by creating and editing list items. Your Flow should run only when and item has changed.
- That’s it!
- Click on the ellipses in the top right corner of the trigger an then on settings
- Go to list settings and click on Versioning settings
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.
LikeLike
Hey Mary, you need to replace the single quotes from when you copy and paste. They copy over in a weird format.
LikeLike