Home >Tips >Power Automate >Roll back changes kalmstrom.com site map icon Site map  

Roll back Column Value Changes

A SharePoint Flows tutorial by Peter Kalmström

Flow iconWhen you want to protect a name or another column value in a SharePoint list or library, you can let a flow react to any changes and roll back the value to the original one.

In the demo below Peter Kalmström, CEO and Systems Designer of kalmstrom.com Business Solutions, shows how to create a Department content type, connect it to a new list app and protect the Department name column from changes with a rollback flow.

In his example, Peter uses a Departments list where the name of each department must not be changed. For the flow he creates a separate column for the original name. This column should be hidden to users, and at the end of the demo Peter shows how to hide it.

This flow idea can also be used for other change reactions. Only the last action in the description below, which is the actual rollback, needs to be changed into something else.

"Created or modified" trigger

Microsoft Flow has the SharePoint triggers "when an item is created" and "when an item is created or modified", but there is no "when an item is modified", which is what we actually would need for this flow.

Instead we have to use the "created or modified" trigger and make the flow understand if the item is new or modified. We achieve this by using the fact that new columns have a "null" value before it is used the first time.

If the item is new, the name should be considered the original one, but if it is modified the flow must compare the name with the original one and decide if it the same or not.

NOTE: If you use the SharePoint action ‘Update item’ on the same list as the trigger ‘SharePoint - when an item is created or modified’, there is a risk for an infinite loop of flow runs. When I recorded the demo, the infinite loop risk was not acknowledged, but now the Flow Checker gives a warning. Therefore, we now recommend to use the new action ‘SharePoint – Get changes for an item or a file (properties only)’ action, and set a condition for the update action. The warning will not go away, but you will avoid the risk for an infinite loop. This is described in detail in the book, SharePoint Flows from Scratch.

Flow steps

  1. Create an automated blank flow and use the trigger SharePoint - when an item is created or modified' for the Departments list.
  2. Add a condition to check which one of the two trigger parameters are valid in this case created or modified: the dynamic content Original Department Name is equal to the function null. (Start writing "null" in the function field under the 'Expression' tab and select 'null' from the dropdown)
  3. If the condition is true (= the item is new), add the action SharePoint, update item for the Departments list. At Original Department Name, add the dynamic content Department Name.

  4. If the condition is false (= the item has been modified), add another condition to check the value of the Department name column: the dynamic content Original Department Name is not equal to the dynamic content Department Name.
  5. If the second condition is true (= the names are not the same), add the action 'SharePoint update item for the Departments list and add the dynamic content Original Department Name in the Department Name field.

  6. Save and test the flow.









back icon next icon


Products Buy FAQ Services Tips Books Contact About Us Tools

Security and integrity

Copyright  Kalmstrom Enterprises AB  All rights reserved