How to Use Fault Path in Salesforce Flow

If your Flow includes a DML element such as Create, Update, or Delete records, or a Submit for Approval core action, then there is a possibility that it might fail. For example, a create or update may fail if it does not pass the validation rule. And when the flow fails, Salesforce displays a standard message in red text that reads “An unhandled fault has occurred in this flow”. But with an error message like this, users will have no clue about what happened and if they did anything wrong.

A better option is to use something called ‘Fault’ path in Flow. Fault Path is also called Fault Connector or Fault Line. With Fault path, you can display a more meaningful message and guide users on what to do. To create a fault path, create a screen element with a useful message and connect it to the DML element.

Customize the Error Message

For the screen element, you can use ‘Display Text’ or ‘Display Image’ components to make the error message visually appealing, pun intended and in context. For e.g., you can add an emoji with some stylized text to inform users of the error that happened.

Taking Error Handling to Next Level

With Fault path, you are not restricted to just displaying a custom error message. You can also add other components of Flow such as:

  • Assignment Element - To capture some information in a variable

  • Text Template Resource - To draft a template with variable values to be used in an email

  • Send Email Core Action - Use the values from a variable to send an email with error details to the system administrator

  • Create Records Element - To create a Case and assign it to your IT department

Error handling in Salesforce Flow seems like an interesting feature with a multitude of possibilities. In this short guide, we will be building on the Flow that we configured in the #Step By Step Guide To Creating Screen Flow in Salesforce. If you haven’t looked at the screen flow guide, I recommend that you go through that post first, configure the Flow, and then come back here to continue with this guide. In this guide, you will learn how to:

  • Add a Static Resource in Salesforce

  • Add a Fault Path to a Flow element

  • Test a Custom Flow Error Message

And it won’t take more than 10–15 minutes of your time

References & Useful URLs