top of page

How to handle errors in Power Automate cloud flows

💡 It can be sometimes challenging to figure out how to handle errors properly in Power Automate cloud flows. Let’s discover the best practices.

Problem Description


No matter how well-designed the logic in a workflow is, it can fail due to changes in the data source or unforeseen use cases outside the original design. In these situations, it’s essential to have a process in place to manage these errors.


Automated workflow processes play a crucial role in the success of your business, and if a workflow fails, it’s vital to receive immediate notifications.

Solution


One common pattern for error handling is the “Try-Catch-Finally” pattern. We can use it as below:


  1. Add a scope action and rename it to “Scope - Try”. This scope will have all the main actions for the automation. (The example below shows a simple flow to “Create an approval”.)



     

  2. Add a new “Scope - catch” action directly below the “Scope - try” action, configured with the “Run after” settings as below. This will handle any errors. Normally, we will add “Send an email” action in this scope, to notify the end user of any errors.

     


     

  3. Add a “Scope – finally” action directly below the “Scope – catch” action, configured with the “Run after” settings as below. This will contain any actions which must be executed regardless of whether the main actions succeed or fail.

 


Advanced steps (optional)


In the “Catch” scope, we can use the Workflow function to extract more information about the flow run, including the link to the flow action. This is done using the “Parse JSON” action. An example is as shown below:


 

Note that when you Parse the JSON from workflow(), two name properties are outputted. Make sure you select the run name.



Additional Information


  • Last updated on: 9 Dec 2024

  • Tested version(s): 2411.3

  • Prerequisites: None

  • Dependencies: None

  • Known issues: None

bottom of page