This flow template can be used as a default template for every flow you make. It contains a try-catch-finally mechanism by using scopes and has functionality to create an error stack and process this stack as a JSON object or HTML text which you then can use to notify observers via actions like Send an email (v2). Moreover, the flow contains a flow config variable in which you can configure specific context variables like a dry run or whom the observer is in cases of errors. Want to see how you can implement this flow? See minimal path to awesome.
Download the flow ZIP package here!
Solution | Author(s) |
---|---|
Flow template with error handling | cup o'365 (contact me) |
Version | Date | Comments |
---|---|---|
1.0 | July 2, 2022 | Initial release |
- Download the flow ZIP package, browse to Power Automate, sign in and import the ZIP package as cloud flow
- Change the trigger. To avoid this flow having connections you would have to create, the trigger is set to manual.
- Configure the varFlowConfig variable
- Start building your flow inside the try-scope
- Append every container action inside your flow to the filter in the catch-scope (see screenshot below). Container actions can disguise errors within them. Therefore, each container action should be added to the 'From' formula in the filter results action in the catch-scope. By default, all existing container actions are already added to the default formula. The formula is
union(coalesce(result('Scope_-_Try'), createArray(null)), coalesce(result('Scope_-_Prepare'), createArray(null)))
. To add an action to this formula, simply addcoalesce(result('{NAME_OF_CONTAINER_ACTION}'), createArray(null))
. Container actions are: scopes, conditions, switches, apply to eaches and do untils. - To allow the flow to notify an observer in case of an erorr: add an email action in the catch-scope if needed. To avoid the flow having connections, an email action (or any other notification for that matter) is not included, but you can add it yourself to the last condition of the catch-scope. This condition already contains a compose action with proposed input. An example of an email with this input looks like this:
- Enjoy :)