How to get error message from failed scope in Power Automate flow

Hello everyone and welcome to my blog. In today’s blog I shall walkthrough the steps to get the error message when a prior scope failed in Power Automate flow.

Using scopes to mimic Try-Catch behavior in Power Automate is pretty well known and has been aptly documented in quite a few articles. But there are very few articles which actually discuss on how to get the error message from the failed scope.

Here we are going to do just that in few simple steps.

For this demo, I have a used a flow with Manual trigger. I have a scope named ‘Try’ where I am trying to retrieve a record from DataVerse using Id. To make sure the operation generate an error, I am passing an ID value which is not there.

Next I have configured a Variable step to run if the previous scope fail. What is important here is the expression I have used to set the value of the errorMessage variable. Below is the expression for the same.

first(result('Try')).outputs.body.error.message

Observe the usage of the result function. The result is a Logic Apps function which can be used inside a Power Automate flow because Power Automate is built on top of Azure Logic Apps.

The result function return an array from which I am taking the first item using the first function.

Once I run the flow, I am now able to see the error message in the variable.

Hope you liked this post. If this post has helped, you can buy me a coffee. Links on right pane.

For similar topics on Microsoft.NET and Power Platform, subscribe to my blog using the Subscribe option on right pane.

You will also like the below posts.

Debajit Dutta
Business Solutions MVP