“On each error I must restart the whole flow, is it possible to build a ‘restartable’ approval flow that’ll continue from the failed step in Power Automate?”
When building approval flows in Power Automate, you probably put all the steps in a single flow in a sequence. Assign an approval task to a user and once completed assign another one to the next approver. The same steps over and over again until everyone completes their approval task. But what if such flow fails? What if 2 approvers already approved and it failed during the 3rd approval? How do you restart this flow without creating the tasks for the first two approvers again?
Use a ‘state machine’ in your flow
Since you don’t want to create the same approval tasks for the users, you’ll need two things. Firstly, you must keep the information about the current approval step. Secondly, your flow must act based on this information when started.
The first prerequisite is simple – this article is about an approval flow, and each approval flow should utilise some ‘Status’ column with such information. If you don’t have a unique status for each approval step, you should add it now.
The second part of the solution is a bit more complicated. As already mentioned, the flow must act differently based on the stored information, in this case the approval status. Once it’s started it must check the current status to know where to continue – a use case for a state machine!
Following the state machine principle, you can build a flow that’ll trigger on a change in the status column. Depending on the approval status value a ‘Switch’ will store the current approval role in a variable.
Use it to find the current approver in a configuration list and assign the task. Once completed store all the information back to the item itself and set the next approval status.
A new instance of the flow will trigger, checking the new status and creating a new approval task for the next approver.
When building a restartable approval flow in Power Automate, you must somehow deal with the steps that were already completed. In this article it was done using a state machine, a repeated flow that’ll trigger multiple times during an approval process, each time creating task for a different user.
Just remember that the flows don’t share any information. If there’s any information that should be shared between the approval steps, e.g. the approval history, you must store it in the item itself as part of the flow.