“I’d like to see which specific columns were updated in a SharePoint item that triggered a flow, how can I identify them using Power Automate?”
Inspiration for this post is a similar solution from Dennis.
When you work with SharePoint items, sometimes it’s not enough to know that an item was modified. You might need to trigger a flow only on update in a specific column, or perform some action depending on the modified columns. For example, send an information email with the updated columns. But how can you identify only the updated columns?
Note: you must enable version history on the SharePoint list/library for this solution to work.
Get all the SharePoint columns
Power Automate has an action ‘Get changes for an item or a file (properties only)’. As already explained in avoiding duplicate approval tasks, this action can tell you if there was a change in each column. Configure the action, use the item ID, and get the information for previous item version (VersionNumber -1).
Note: there’s also an option to get changes since a specific date and time.
But here comes a problem with the output ‘Has Column Changed:’. It’s a single object with all the columns as properties and the change information as a value. True = column was changed, false = column wasn’t changed. You can easily access information about a specific column, but you can’t filter only the changed ones.
For that you’ll need to further process the result.
Filter the changed columns
As already mentioned, it’s an object and as such you can’t filter the properties based on their values. For the filtering you must turn it in a format that’s easier to work with: an array. But since there’s no possibility for a direct conversion, there’s a middle step. Convert the object to string with string(…) expression, and then the string to an array with split(…) by a comma.
The output will be an array where each item will be a pair property:value converted into a string.
Now, when it’s an array, you can use the ‘Filter array’ to filter only the items that contain the string ‘true’. I’d recommend using string ‘:true’ to avoid situations where the column name contains *true*.
item() contains string(':true')
The output from the ‘Filter array’ will be an array with changed columns only, but still in the property:value format. Which leads to the last step, remove the :value and keep only the property (=column name).
Keep only the column names
At this point you might think about using multiple replace(…) expression to remove all the extra characters. But there’s an easier way to convert it with the json(…) expression. When you apply json(…) on each of the items it’ll do a cleanup.
from: "\"Title\":true" you get: "Title"
Use this functionality in a ‘Select’ action by applying json(…) on each item in the array.
The output will be an array that’ll contain only the updated column names. You can then process it as any other array in your flows.
Full flow diagram
When you check in Power Automate flow which SharePoint item columns were updated, you’ve got multiple way on how to approach it. One option is to convert the whole object into an array as Dennis did, and filter it later. The other option is to reverse the process – filter it first and then convert to an array.
This solution contains multiple conversions – object to string to array to json. Most of the time the action outputs look strange, but at the end you get a single array with the updated columns only. And once you get the column names, you can easily get also their values.
It’s also a solution to get dynamic list of all columns in a SharePoint list or library, you just skip the ‘Filter array’ action.