Power Automate: Cloud Flows + Better(er) Error Reporting


The ask, build on the better error reporting and share the actual error message when a cloud flow action fails. Earlier, the cloud flows were generating way too many error messages, one for each failed action, which was resolved using an array variable to store custom messages specified by the maker, then generating a single email at the end of the flow with the array items included.

Now, the business and the support team are asking for even better error reporting to be included in the error emails. Delivering on this request, the makers are now adding object flow variables to store the output of each failed action, then appending the error message of the object to the error array variable, with both actions nested within a Scope block.

Figure 1 - Power Automate cloud flow with Scope control for better error handling.
Figure 1Power Automate cloud flow with Scope control for better error handling.

Instead of the Append to array variable action being the Run after step for a failure, a Scope control block is added, allowing the makers to easily group multiple actions that need to be performed whenever an action times out, is skipped, or fails:

Figure 2 - Power Automate cloud flow Scope control block with Run after settings.
Figure 2Power Automate cloud flow Scope control block with Run after settings.

But first, initialize the object variable outside of the Scope control. With the variable initialized, within the Scope block, set the Body of the failed action as the object variable’s value:

Figure 3 - Power Automate cloud flow action to Initialize variable.
Figure 3Power Automate cloud flow action to Initialize variable.
Figure 4 - Power Automate cloud flow action to Set variable.
Figure 4Power Automate cloud flow action to Set variable.

Finally, using the error object variable, its properties can be set as the value of the Append to array variable action, to be emailed at the end of the flow, providing the additional error details requested by the business and the support team:

Figure 5 - Power Automate cloud flow action to Append to array variable.
Figure 5Power Automate cloud flow action to Append to array variable.

Conclusion:
Appending error messages to arrays is great for minimizing generated emails, but without the error message of the failed action, the support team doesn’t know exactly why the action failed and how to respond. With this additional context, everyone is happy.

“We must always be a strong presence, an unrelenting force working for equality and justice until the freedom gates are fully open.”

Dorothy Height

#BlackLivesMatter

One thought on “Power Automate: Cloud Flows + Better(er) Error Reporting

  1. Pingback: Power Automate: Cloud Flow + Better Readability (Scope Controls) | console.log('Charles');

Leave a comment