Power Automate: Get Specific Changes to a List Item

Introduction

Identifying if a specific column has changed its value when an item update triggers a flow is often a requirement because based on the value change of the particular column, we may have to run business logic. Power Automate provides a Get Changes for an item or a file Action using which we can identify the change to a specific column.

In this article, we will see how to set up a power automate to identify the value change of a specific column when an item modified event triggers the flow.

Business Use Case

We have a requirement where we have a Marketing procurement List that contains the cost of various purchases done in a Quarter. Since it is a list where multiple people can add and update items, any updates to the already existing purchase cost column should be flagged and sent to the Finance Controller so that he can monitor any suspicious activities.

Implementation

To implement this, we are using a List where we have the below columns. We will be monitoring the changes to the Cost (USD) column in this article.

Background pattern

Description automatically generated with low confidence

Moving over to flow, we will use the When an item is created or modified trigger to start the flow and we will add the variable – CurrentCostValue to hold the existing value in the Cost (USD) column.

Graphical user interface, text, application, email

Description automatically generated

We will then add the “Get Changes for an item of file” action which is going to get the changes that have happened to the item. We will specify the ID dynamic property in the Id field of the action and in the Since field we will mention the Dynamic Property of the trigger – Trigger Window Start Token.

The trigger window start token is a token expressing the time of the last flow which can be used to identify if a column has changed since the last flow run.

Graphical user interface, text, application, email

Description automatically generated

In case if we want to get the previous Column value to intimate the end user about the detailed change from the Previous to the New value, we can use the HTTP trigger to get the version history and then pick the old value from the older version. We are sending a Get request to the below URI to fetch the version specific data.

_api/web/lists/getByTitle(‘Marketing Procurement List’)/items(@{triggerOutputs()?[‘body/ID’]})/versions(@{outputs(‘Get_changes_for_an_item_or_a_file_(properties_only)’)?[‘body/SinceVersionID’]})

The general syntax used here is: Uri:

/_api/web/lists/getByTitle(‘<listName>’)/items(<itemID>)/Versions(<versionID>)
Graphical user interface, text, application, email

Description automatically generated

We can see that the Version ID is available as a Dynamic output property of the ‘Get Changes’ action where Since Version ID and Since Version Label indicates the 1 version previous to the current version which triggered the flow. So, for the HTTP Request URL, we can use the SinceVersionID value to fetch the details of the previous version.

Text

Description automatically generated with medium confidence

Now we will add the condition check to see if the column Cost(USD) has been changed for which we will use the Dynamic Content ‘Has Column Changed(USD)’ which contains a Boolean value indicating value change. If it is equal to true, that means the cost column has been changed and we need to intimate the change via mail through the Yes Branch.

Graphical user interface, text, application

Description automatically generated

We will add the send a mail action and specify the old value through the below expression

outputs(‘Send_an_HTTP_request_to_SharePoint’)?[‘body’](‘d’)(‘Cost_x005f_x0028_x005f_USD_x005f_x0029_x005f_’)

as well as, the new value which we have saved in the variable at the beginning of the flow. This was the change in values that can be easily ascertained by the user. Thus the overall flow will look like this:

Graphical user interface, application

Description automatically generated

Test the flow

Let’s test the flow by making changes to one of the items in the list. The current value of cost for the Flyers and Branding item is 850

Graphical user interface, application

Description automatically generated

Let’s change it to 1500

Graphical user interface, application

Description automatically generated

This will trigger the flow and the get changes action will help us identify the change through its Output ‘has Column Changed: Cost(USD)

Graphical user interface, text, application, email

Description automatically generated

We have also received the Alert mail with the old value (obtained through the HTTP Request) and new value

Graphical user interface, text, application, email

Description automatically generated

Summary

Thus we saw how we can easily identify if a change has happened to a specific column when an Item Updated event is triggered in the SharePoint List.

Related Articles

Author

Author

Priyaranjan KS is a Modern Workplace Architect primarily focused on developing and architecting solutions around Office 365,Power Platform and Azure.He is also a Microsoft Most Valuable Professional(MVP) and a Microsoft Certified Trainer(MCT)

Latest Articles