Recently the Get changes for an item or file action was added to SharePoint. Here a full overview
Get changes for an item or file action
The Get Changes for an item or file action will require your list or library to have versioning enabled. If you don’t have versioning enabled you will see the following error message:
Versioning not enabled for list
You can enable Versioning in the list or library settings
Nothing complicated here. Be aware however that the versioning settings will affect the functionality in your flow. So for example the number of versions kept will be important for your flow.
Once enabled the action will now work and return data.
At the end of the long list of true/false values there is a short overview in json, which is a bit easier to use. Here we can see that I updated the column with the name Choice
So now we know the fields that have changed but we don’t really know what they changed to or from.
Versions of items or documents
When you look through the dynamic properties, you will very quickly bump into the Since Version Number and until Version number
These give you the range of version numbers that the flow has checked.
Now if only we could get to the data of a version number of data in SharePoint!
Well we can. but it might not be as easy has you hoped for
You will need to build up the following configuration for the Send an HTTP request to SharePoint action.
I’m now going to use the SinceVersionId to query the versions of the list item that was changed and that triggered my flow.
I can do that with the following expression. Note that this is SinceVersionId and not SinceVersionLabel.
How to get the previous values?
We now need to have another look at the Get changes for an item or a file action
If we now configure the Until field to get its date from the Modified date of the trigger minus one second. Then we know that we have the previous version of the item and the job is done!