top of page

Advance Error Handling in Flow.

Power Automate’s default response to errors from connectors is pretty simple – exit the workflow right there and record the entire run as a failure. In most cases this is what you might want, however sometimes you need to handle an error yourself and take action on it, or ignore it and move on, similar to a try-catch approach in many programming languages.

For example, before committing a record, you might want to check if it already exists first. If it does, then perform an update if it doesn’t, go ahead and create it. When calling a RESTful web service to fetch a record by a unique ID, if it can’t be found, the service will most likely return a 404-status code. In Flow, a 404 is considered an error, and the workflow will fail and terminate at that point unless additional error handling is implemented. In this case though, a 404 shouldn’t be considered an error per se – it’s a legitimate response that tells you something, which you want to then handle and move on from.

One of the biggest issues of using power automate among current users is not using error handling.

The following shows two approach on error handling :

1. The more appealing approach is to use scope. As we can see below i have created three scope blocks named Try, Catch and Finally.

The flow as in product gives you an ability to "configure run after " setting in almost all operational actions and you can leverage that to make the below logic work.

In the below example , the developer is not sure that account GUID it got from the HTTP request is correct w.r.t. to the "current environment " in CDS i.e Common Data Service.

So the creation part is kept in TRY scope.

Now we can configure the CATCH scope and it should only trigger when the TRY scope has failed.

we can add some sort of alerting in catch to notify the stakeholders that there is an issue.

At last , we can configure the FINALLY scope , we can add further logic if needed once the entire flow ran and is about to exist.

Notice that FINALLY is configured to run in both the scenarios : if the catch is successful or it's been skipped because TRY scope was successful.

2. The Other effective method can be used in existing flows is use of statuscode :

Checking the status of a Http call/ CRUD operation on a service, here it's Common data service.

In below example in case of a failure , i can add a notification/email or a create a bug in ADO connector in else part to notify me that there was an issue in creating the new record. This really helps in scenarios where we are using power automate as an integration layer between systems.

96 views0 comments

Recent Posts

See All
bottom of page