Summary:
We will be using the Try - Catch structure to build out this solution.
This will involved 2 Scopes - Scopes are an action in Power Automate that can hold other actions.
Steps:
For our 2 Scopes we will name,
Scope1 = Try
Scope2 = Catch
In our Try scope we put all our regular actions that we expect to run on a successful run
In our Catch scope we put what we want to execute if anything from our Try has failed.
This is what it should look like:
Now we want to configure run after on the Catch scope to enable this cope to run only if Try has failed
To do this, click the 3 dots on the Catch action, and click Configure run after, and check the has failed box
Click Done.
Now it should look like this:
Notice the red arrow, this is stating there is a Configure run after enabled.
Now in our Catch scope add a Compose action, we will use the expression result( )
The syntax for result() is:
result('ActionName')
So my expression looks like this:
result('Scope_-_Try')
**NOTE: The result expression does not show up in the list of expressions when typing out the expression**
Next add a Parse JSON action, and pass the Outputs from the Compose.
Here is the schema:
{
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"startTime": {
"type": "string"
},
"endTime": {
"type": "string"
},
"trackingId": {
"type": "string"
},
"clientTrackingId": {
"type": "string"
},
"clientKeywords": {
"type": "array",
"items": {
"type": "string"
}
},
"code": {
"type": "string"
},
"status": {
"type": "string"
},
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
},
"required": [
"name",
"startTime",
"endTime",
"trackingId",
"clientTrackingId",
"clientKeywords",
"code",
"status",
"error"
]
}
}
After the Parse JSON action, add a Select action, this action will be used to only grab the data we want.
Put the Body in the From field, and than build out what information you want to see in this message.
Here is a sample run:
This Select output can than be used inside a Send email action or a Teams message.
Thanks for reading!
Check out my blog on flowaltdelete
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.