Your Flows may get rather complicated over time and often they can contain many atomic Actions that need to be considered as a transaction. That is, either all actions should succeed or all actions should fail.
When we use a system such as SQL server transactions are built into the processing layer and are all committed at the end of the task in one go. That way, we can do all the processing and submit the transaction. And if anything fails, none of the transaction is committed.
With Flow we don’t have this capability. When you think of the Internet of Things, or a micro-services architecture we don’t have this ability. We are interacting with discreet and independant services.
We can take my Red Plane Insider onboarding process (launching soon) as an example. This requires the user to fill in a Microsoft Form to provide their basic contact information and credit card details. When they submit the form we want Flow to do the following things:
- Check the users email is valid
- Create a new customer in Stripe
- Create a Credit Card in Stripe
- Create a Subscription in Stripe
- Create a User in a MailChimp list
- Create an Azure AD B2C Guest User
This process in its entirety is our “transaction” and if any part of it fails we want to roll back any steps previously actioned.
The way that I do this is to create a variable at the start called “backout_actions” and set its type to be an Array. An Array is a programmer term for a list of things or a collection of things.

Now, each time one of the above steps is successful I add an entry to my Array.

I keep building this Array up throughout the Flow.
If at any point an action fails I can set the value of another variable to show the transaction has failed, or has been a success. This might require us to perform some error handling. Then at the end of the Flow (so we only have to define this rollback process once) we can loop through this Array and perform actions to undo the steps we successfully performed.

I hope this helps a few people out there. I’ll be keen to hear your feedback and approaches with this.