Is there any way to retrieve the action names within the try
block? I need to obtain these action names and create a string with them separated by commas. How can I achieve this?
Tried the below but not working
@actions('Try').actions
Is there any way to retrieve the action names within the try
block? I need to obtain these action names and create a string with them separated by commas. How can I achieve this?
Tried the below but not working
@actions('Try').actions
2
Answers
If your aim is to list all previous actions (and extract the result), try this code in your catch block:
The
result()
function returns the results from the top-level actions in the specified scoped action. This also contains the names of the actions.You need at least 2 actions for this.
Firstly, you need to use the
Select
action to get the names of the actions within the "Try" block as an array:You should be selecting
@item()?['name']
from@result('Try')
.Secondly, you need to transform the array to a comma-separated string. You can use the
join
function for this:@join(body('Select'), ',')