Sub topic 10
Flow Error Emails and Monitoring Failed Interviews
This chapter assumes you can build a basic flow, have read the earlier chapters on fault paths and debug logs, and can open Setup in a sandbox or Developer Edition org. It covers what Salesforce reports when a flow fails, where to look for failed interviews, and how to add your own monitoring.
What an unhandled error does
An interview is one run of a flow. If an element fails and has no fault path, the interview stops. Salesforce then does two things:
- It rolls back the transaction, so the records the flow changed in that transaction are not saved.
- It sends a flow error email.
The error email names the flow and the interview, the element that failed, and the error message. Use it as your first lead. The element name tells you where to set up a debug run, and the message usually points to the cause. For example, REQUIRED_FIELD_MISSING means a Create Records or Update Records element left a required field empty.
If a fault path handles the error, Salesforce treats it as handled and does not send the standard email. This matters for monitoring. A fault path that does nothing also hides the failure from everyone.
Choosing who receives the email
Recipients are set in Setup, under Process Automation Settings. The setting for error emails lets you pick between the Apex exception email recipients and the person who last modified the flow. Check the exact options in your release, because the labels have changed over time.
- The last modifier is often a developer who has since moved on, or an integration user whose mailbox nobody reads.
- Apex exception email recipients can be set to a shared mailbox or a team distribution list. This usually works better for a production org.
Finding failed interviews
Email is not the only record. In Setup, search for Paused and Failed Flow Interviews. The page lists interviews that paused or failed, with the flow name, the interview, and the error. Paused interviews can be resumed or deleted from here. Failed interviews are there to inspect.
Not every failure appears in this list. Errors inside a record-triggered flow roll back the whole save, and the user sees the error on screen. The error email and debug logs are the more reliable records for those failures.
Building your own notification
A fault path is the place to add monitoring that you control. Connect it from the element that can fail to a Send Email action, or to a Create Records element that writes to a custom log object. Use the $Flow.FaultMessage global variable to capture the error text. This is a template for the email body. $Record.Id only works in record-triggered flows.
An error occurred in the flow: {!$Flow.FaultMessage}
Flow: {!$Flow.CurrentDateTime}
Record Id: {!$Record.Id}Keep these rules in mind when you build it:
- Put the flow's API name in the body as plain text.
$Flow.FaultMessagedoes not include it. - Send to a shared mailbox, not to one person.
- Do not place the email action inside a loop. One failing record in a bulk update could send hundreds of emails and use up your daily email limit.
- After the notification, end the fault path with a Custom Error element if the save should still fail. Otherwise the flow reports success while the original change goes ahead.
Monitoring at scale
For an org with many flows, reading emails one by one does not scale. Two options help:
- Log object plus report. Write a record per failure, with fields for flow name, element, message, and related record. A report grouped by flow shows which flows fail most.
- Flow execution error events. If your org has Event Monitoring, the
FlowExecutionErrorEventplatform event publishes unhandled flow errors. A subscriber, such as another flow or an Apex trigger, can route them to a log or chat channel. Check your licence before you plan around it.
Review your channel on a schedule. Failed interviews that nobody reads are as bad as failures that were never reported.
Exercise
A record-triggered flow has a fault path that sends an email using {!$Flow.FaultMessage}. The flow fails, and the admin receives the custom email but not the standard flow error email. Is this a bug, and what should the fault path do if the user's save should still be blocked?
Show answer
It is not a bug. A connected fault path counts as handling the error, so Salesforce does not send the standard error email. To block the save, end the fault path with a Custom Error element so the transaction fails and the user sees the message. Otherwise the flow reports success even though one element failed.