Because you will need it….
Always validate anything that comes from a user.
When somethign goes wrong, capture the error and write it to an entity. You will need:
- The URL of the Flow run:
- The error from the Flow that made it fail.
To get the Flow run URL use:
concat('https://unitedkingdom.flow.microsoft.com/manage/environments/',workflow()['tags']['environmentName'],'/flows/',workflow()['name'],'/runs/',workflow()['run']['name'])
To get the error codes, use a Try Catch (in scopes). The catch scope will run on fail of the catch scope.
Result from Try : result
('Try')
Filter array result : outputs('Result_from_Try')
and item()?['status']
Error Output to write to log.
Error action : body('Filter_array_Result')[0]?['name']
body: body('Filter_array_Result')[0]?['outputs']?['body']['error']?['message']

Output after a run:
Flow Run : https://unitedkingdom.flow.microsoft.com/manage/environments/tt21ceed-zzzz-zzzz-yyyy-b4c05c6a5ba5/flows/be91ecdb-9ded-e466-047d-da81cbfcd4d5/runs/08585752274884620792333018212CU08
error Action : Add_user_to_PowerApps_group
body: One or more added object references already exist for the following modified properties: 'members'.
Hat Tip to Richard Wilson.
1 Comment