Terminate The Flow With A Status Of Success Or Failure
A flow using error-handling will continue to run after it encounters an error. It will end with a status of succeeded even though there was a failure. To overcome this issue, include terminate actions as the final flow steps to ensure to correct status is displayed in the flow run history.

Notify The Process Owner Of The Flow Failure
Alert the business process owner when the flow fails to let them know there was an issue. If no one is notified when the flow fails then it will not get fixed and could continue to happen.

Get The Flow Error Message For The Failed Action
The reason for flows failures are not often not known in advance. This makes writing an error message before-hand difficult. By using the actions expression we can extract a useful error message from the flow action that failed.

Add a failure reason section to the flow failure notification and use this expression.
actions('Compose:_Test_Value')?['error']?['message']
When the flow fails an error message will appear in the flow run history.

Then the message gets included in the flow failure notification to the business process owner who will take action on it.

Include The Flow Run History URL
A clickable link to the flow run details should be added to the failure notification. The message can be forwarded to a developer who can quickly identify the failed flow run in the history. Then they can review the issue and diagnose the problem. To do this, use this following coding pattern:

Flow expression #1 gets the environment’s unique identifier.
outputs('Compose:_Get_Workflow_Details')?['tags']?['environmentName']
Flow expression #2 extracts the flow’s unique identifier.
outputs('Compose:_Get_Workflow_Details')?['name']
Flow expression #3 finds the flow run’s unique identifier.
outputs('Compose:_Get_Workflow_Details')?['run']?['name']
The failure notification email looks like this:

Comments