Reputation: 1074
I have a logic app, and there are 2 actions related to question.
How can i get specific error message from 1st action and use it in second (in expression)? I noticed that there are many scenarios possible.
Upvotes: 0
Views: 2240
Reputation: 187
if you have more "levels" in your logic app, for example
a scope -> loop -> condition
then you need to union() the result() from each "level":
@union(result('scope'),result('for-each'), result('condition'))
then you can filter thru this array to find what you are looking for, I use it to find Failed runs and its outputs
Upvotes: 0
Reputation: 11262
This is a flow that demonstrates what to do ...
A lot of it is semantics to throw an error but the most important section is at the bottom.
Basically, within the Scope
section, I'm setting a variable that divides an amount by 0 which, as you'd expect, throws an error.
The Initialize Error
(set as an Array
) step at the bottom reads the result information that comes out of the Scope
execution. You can do this by using the result()
expression.
So in completeness, the expression within that step is ...
result('Scope')
... but you also need to make sure you set the behaviour of the Initialize Error
step to actually fire after an error from that which occurs within the Scope
...
... and this is the result of that execution ...
{
"variables": [
{
"name": "Error",
"type": "Array",
"value": [
{
"name": "Set_Result",
"startTime": "2023-03-23T21:10:37.2196056Z",
"endTime": "2023-03-23T21:10:37.2664847Z",
"trackingId": "aae322b9-1fe5-4d64-86fe-aee282dbfad9",
"clientTrackingId": "08585220010487995760029287748CU07",
"code": "BadRequest",
"status": "Failed",
"error": {
"code": "InvalidTemplate",
"message": "Unable to process template language expressions in action 'Set_Result' inputs at line '0' and column '0': 'Attempt to divide an integral or decimal value by zero in function 'div'.'."
}
}
]
}
]
}
Upvotes: 3