Power Automate: Start a Flow from a column change

With Microsoft Power Automate we can now create flows that start based on specific columns being updated in SharePoint!  This is a feature I have been waiting on for years! The action is called Get changes for an item or a file. The action returns a boolean for each field, whether it was just changed or not. Based on this boolean you know if a field was changed.

Creating the flow

  • Create a SharePoint list, I created the following project list.
  • Enable versioning on the list.
  • Create a flow and use the trigger When an item or a file is modified.
  • Select your site and list.
  • Add the action Get changes for an item or a file (properties only).
  • Fill in the site address, library name and the ID of the item that was triggered.
  • The field Since is used to get the changes we need to make a comparison. If you use 1.0 you will compare the current item version with version 1.0. But we want the latest changes so we use the following expression.
sub(int(triggerOutputs()?['body/{VersionNumber}']),1)
  • I want to send an email when the end date of a project changes.
  • Add the action Conditions to check if the end date was changed.
  • Add the dynamic content Has Column Changed: End date.
    This returns a boolean value.
  • Put the required actions in the If yes section after the condition.
    In my example I am sending an email.
  • Add the action Send an email (V2) and fill in as follows.
Share

42 Replies to “Power Automate: Start a Flow from a column change”

  1. Thank you very much for this clear post, I’ve used this to create two new flows this morning – like you, I’ve been waiting for this for some time!

  2. Thanks for this! I too have been waiting for this trigger and action. You explanation is clear and well done.

    Just wanted to chime in and say thanks

  3. Outstanding work with a very clear writeup. This should really be part of the core documentation in MS Learning. Hats off, Ben!

  4. Unfortunately I got an error in “get changes for an item or a file” which is:
    Specified Version Label does not correspond to any actual version

    I have checked file in my library and I can see all versions in history, so am not really confident what should be changed. Even field “since” was correctly filled with latest version by the formula provided. Any idea what to change?

    1. So its happening when my Library content approval option is ticked Yes. No idea, how to bypass this….

      1. Michal,

        I was also getting the same error with the approval option selected in my list. In the advanced options if you will allow the use of minor versions the flow will then work. I do not know how to compare changes from Published Version to Published Version.

  5. Hi,
    I get this error:
    ‘Unable to process template language expressions in action ‘Get_changes_for_an_item_or_a_file_(properties_only)’ inputs at line ‘1’ and column ‘2908’: ‘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 help?
    Regards,
    Daniel

  6. I have three values that will be updated by different teams. I have 3 separate notifications, each set up like above, targeting one of the three fields.

    Currently, this is how notifications are updating:
    Field 1 changed: Notification re: field 1
    Field 2 changed: Notification re: field 1 and field 2
    Field 3 changed: Notification re: field 1, field 2, and field 3

    I have tried to compare to set “since” to 1, I have also used the string above to compare to previous version only.
    I have set up additional conditions, where “has field 1 changed” = y, “has field 2 changed” = no, “has field 3 changed?” = no. This results in “false” so my action does not trigger at all.

    Any help would be appreciated!

  7. I have the same issue as Daniel.

    Power Automate is automatically putting the “Getting changes for an item” action into an “Apply to Each” block. I think that makes this formula wrong: sub(int(triggerOutputs()?[‘body/{VersionNumber}’]),1) as it’s referencing the wrong outputs.

    My Power Automate isn’t up to working out what it should be, I tried sub(int(When_an_item_or_a_file_is_modified()?[‘body/{VersionNumber}’]),1) but that didn’t work either (although it was at least valid!)

  8. In answer to my own question, it should be:

    sub(int(item()?[‘{VersionNumber}’]),1)

    which works nicely!

    I assume Power Automate is adding the “Apply to Each” as it’s possible to get multiple changes in one trigger event, so you need to loop through them all.

  9. Hi and thanks for this informative article. I’ve attempted to follow your steps, but have run into an error. Error with “Get Changes For an Item or File” – Invalid format for version input value

    I have included this in the Since field: sub(int(triggerOutputs()?[‘body/{VersionNumber}’]),1)

    Until field is left blank (should this have any values?)

    Include Minor Versions field set to Yes.

    and as for the Condition I’ve set Has Column Changed: Work Order ID is equal to True.

    Just to note my versioning settings for this list does have “Create a version each time you edit an item in this list” enabled and have set to keep the following number of versions: 1000. Is there a recommended number of versions to keep? Thanks so much for your help!

    1. I had the same issue when I accidentally entered the text directly in the Since field instead of entering it in the Expression pop-up. When I entered it as an expression rather than as a string, the flow succeeded.

  10. Hello, can you tell me if this will trigger for new entries? I’m feeding data to my list via a powerapps form and need both new and modified entries to trigger. Thanks in advance!

  11. Hi Ben, Wish this thread came up last week when I first stated looking for a solution. PERFECT first go.

    THANK YOU!!!!

  12. Now that we know a field has changed, I want to send an email that says it changed from “previous value” to “current value”. Any way to do this?

  13. I am very glad to see, that so many people find the post very helpful!
    @Beverly Hill: Great question, I am not sure if that is possible. I would like to know that too.

  14. THANK YOU!!!!!!!!! I’ve spent hours trying to piece this together, and your clear post just allowed me to gain a few extra hours of sleep tonight. Seriously. I am so grateful.

  15. Hello, I’m getting this error, can someone here help? Unable to process template language expressions in action ‘Get_changes_for_an_item_or_a_file_(properties_only)_2’ inputs at line ‘1’ and column ‘18309’: ‘The template language function ‘int’ expects one parameter: the value that is to be converted to an integer. The function was invoked with ‘2’ parameters. Please see https://aka.ms/logicexpressions#int for usage details.’.

    1. Also, I read about the add each comment here but its not clear on how to fix this. How do we fix it so that this error doesn’t occur. If we need to remove it from ‘add each’ how do we remove it?

  16. Hey Ben! I am brand new to Flow (although have years of experience with SharePoint Designer workflows). This article is FANTASTIC! But, I need help with the Condition section. It always returns “Expression = False” even though it is not false. Any advice?
    Thanks!

  17. In the Trigger action, can we move all the files to a particular folder whose status has changed in the status column. When I try to use ‘move file’ It ask’s for a just one particular file. I would like it for all the docs in that folder

  18. Hi Abhisheksinh Rathore,

    You can, just use an action to get all the items in the folder.
    And then move the items in a loop.

    Hope it helps,

    Greets.

  19. I was getting the same error as others… I changed the “int” to “float”, and then it worked. Versions are 2.0, 3.0 and such.

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

  20. Great post!

    Do you know how I would alter this so that it reoccurs once a week, and sends out the column changes separately at that time rather than sending out the changes by email as they occur? I tried putting in addDays(utcNow(), -7) in the “Since” field so that it would look for the version changes since 7 days ago but I get the error “invalid format for version input value”‘.

    Any help would be much appreciated!

  21. could you please, breakdown and explain about this code ?
    sub(int(triggerOutputs()?[‘body/{VersionNumber}’]),1)

  22. Hi. I just tried this, but it sent an email even when the column was empty or not modified.
    I want an email to be sent when the AssignedTo column is first completed or changed.
    Whatever I do, I still get emails. I tried not filling in AssignedTo, and got an email, Then i had a line that was already assigned, so i changed the Status, (not AssignedTo) and got an email.
    is there anything else i can try?
    I tried using And / Or conditions, but i still get an email when anything is modified or created (not just the specific column) Any suggestions will be welcome! thank you

  23. Guys, I do not see the Dynamic content “Has Column changed…” from the list. How do I get to pick it?

    1. Mani — did you learn why “Has Column changed…” never showed up, as I don’t either. i might have to hit MS documentation a bit more…

  24. Hi Ben. This is a great post. I tried it on a document library and it worked with all the columns except for “Title/Name” which is the column that contains the document. For example if I change something in the document or I edit the name, the flow runs, but when it gets to the condition, it doesn’t recognize it as a change and brings it down the “No” path. Do you know if this should work with the “Title/Name” column? Thanks!

    1. Hi Yvonne,

      I never tried it for those fields. The name field is a bit of a special field so maybe thats why it does not work. Does the microsoft documentation say anything about it?

  25. Hi Ben, great tip!

    I’ve been using the SharePoint ‘out of the box’ Issue Tracker for internal IT Jobs, but have now started down the path of working out how to do it myself with PowerAutomate/Flows. Quick simple question – I want to kick off a Flow when a List Items ‘Assigned To’ field is changed i.e. if Bob changed the Assigned To: column from Bob to Fred, then the Flow kicks off and notifies Fred in an Email that the job is now assigned to him.

    I followed your helpful instructions to build the new Flow and it triggers/runs successfully – with one small issue. When I assign the Job to myself nothing happens, I do not get the email notification that I have been assigned the job … the Raw Inputs from the successful run of the flow says:

    Has Column Changed: Assigned to
    False

    Yet if I go into the Job, change the Assigned to field to anyone else – it fires correctly and sends out the email. Not sure how to troubleshoot/fix this. Has anyone else come across this? Versioning is working. The Raw Inputs of the flow show increasing Version Numbers each time the flow runs. The Flow triggers on each change … but doesn’t seem to recognize the change IF it’s me the Assigned To column is changed to.

    I note that the built in Issue Tracking List part does automatic notifications when the Assigned to field is changed – any idea how it does that?

    Cheers for the assistance so far, I am learning more and more as I play around 😉

  26. Thanks for the great walk through! I have been using this to trigger a flow when a column is changed, however I’d also like it to run on creation of the list item, so when version is 1.0. It comes through as FALSE as I guess the column hasn’t ‘changed’ when it’s created for the first time. I used a catch for ‘OR if Version = 1’ and this was working for awhile, however occasionally 2 versions are created at the same time, with same time stamp causing the flow to read V2 and not trigger. ANy ideas for making this trigger for new list items as well as changed columns?

Leave a Reply

Your email address will not be published. Required fields are marked *