Rollback a request on Failure in Power Automate

Isaac Stephens, 16 June 2022

When using Power Automate to update Dataverse / Dynamics 365 you may not want the changes to be saved if a related action fails. For example, you may want to create two records and then update a third, but you only want this to happen if all three are successful. In this blog post I will show you how this is possible using Change Set Requests.

image

The above image shows an example of a standard Flow processing two actions sequentially and then failing on the third. Due to this set up we will have two records created in the Dataverse but no update to the third. If you want these to be processed as a unit, you can use the ‘Perform a changeset request’ action. This allows you to couple actions together to ensure it is either all or nothing.

image

The action is found under the Dataverse Connector and is called ‘Perform a changeset request’. Once added to your flow you will be able to add your Dataverse actions to it, these are limited to the basic Update, Delete, and Create actions (CUD). Because it is limited to these 3 actions, any additional actions/logic you need to use (retrieves/conditions/variable assignments/etc) will need to be done prior to the changeset request.

image

As you can see from above, once the Flow runs and the last step fails instead of having the green ticks on the two ‘Add a new row’ actions we get grey crosses saying they have been skipped. Another positive thing with this is that no ‘On Create’ plugins/workflows/Flows are triggered, so you don’t need to worry about any unwanted logic running.

Since a failure in the changeset request causes the action to fail this mean we can utilise another feature of Power Automate, the ‘Configure Run After’ setting. Shown below is an example of an email notification being sent on failure of the request.

imageimageAs you can see, by using Change Set Requests in Power Automate you are able to ensure that all of the actions are successful before actually updating Dataverse / Dynamics 365, mitigating the impacts of unwanted data being created in CRM as well any additional logic being triggered when it shouldn’t.