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
Table of Contents
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.
outputs('Get_changes_for_an_item_or_a_file_(properties_only)')?['body/SinceVersionId']

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!
Hi. Great stuff but can you please share the settings for that last piece – Get changes Until ?
The easier way is actually to take them all abd then with the first function take the first item.
If you only want to check against the previous version you can use the expression “sub(int(triggerOutputs()?[‘body/{VersionNumber}’]),1)” in the Since column.
Hi Kev, does the expression above work if the previous version is between 0.2 and 1.0, or is it only for changes to version higher than 1.0? TIA
You don’t necessarily need a date value in the Since or Until fields. You can also put a version number in and only get changes that were made between these versions. This can be useful if you only want to compare the change between the current (last) and the previous version. Only tried this for lists with major versions only successfully.
You legend!! Thank you muchly for this expression. Saved our bacon!
Hello,
Is it possible to get the previous value and include it in my email notification (with the new value)?
Hi Pat, You can get the changes for an item/document with one of the actions in the SharePoint connector or using the REST API.
the action that you migth be look for is called: Get changes for an item or a file