Power Automate SharePoint Get Column Changes
With the Get Changes Action in Power Automate we can determine if a column has changed in your SharePoint list or library. But how do we determine what the value was before it changed? There are a couple extra steps needed in order to figure out what the previous values were. I outline the steps to accomplish this below and walk through it all in the corresponding video.
Step 1: In your new flow make sure you have the “When an item or a file is modified” trigger. Right below that add a “Get changes for an item or file” action. Point both of the trigger and action to your SharePoint site and list or library. For the Get changes for an item or file action make sure to use the “Trigger Window Start Token” dynamic property in the “Since” field.
Step 2: Insert a Send an HTPT request to SharePoint action. This is what we have to use to get the previous value. We’re going to use the version history to look up a specific version of an item. Point it to your SharePoint URL and choose “GET” from the Method dropdown. Enter the following for the URI property (replacing the text in getbyTitle with your list name):
_api/web/lists/getByTitle(‘Asset manager’)/items(@{triggerOutputs()?[‘body/ID’]})/versions(@{outputs(‘Get_changes_for_an_item_or_a_file_(properties_only)’)?[‘body/SinceVersionId’]
})
Step 3: Add a condition and use the “Has Changed:” dynamic properties for the value that you wanted to test if it changed and do is equal to true. Inside of the “yes” section of the condition you’ll add a Compose action and this is where we will get the previous value which can then be used in other spots in the flow. Here’s the formula you’ll need to put in the Expression editor to get that (replace the last bracket value with your field name):
body(‘Send_an_HTTP_request_to_SharePoint’)[‘d’][‘Status’]
🔗 Links 🔗
Download the Flow: https://github.com/aprildunnam/Power-Automate/blob/master/GetItemChanges_20210512003702.zip