A fault connector is a type of connector used in Salesforce flows that allows you to handle errors and exceptions that may occur during the flow’s execution.
It allows you to take action in response to different types of errors, such as sending an email notification or displaying an error message to the user.
In this blog, I will be creating a Contact record using Screen flow and will be utilizing fault connectors to capture the errors while executing the flow.
The screen flow is presented on a screen using either a lightning page or a utility bar.
Using a Validation rule I will restrict the creation of the Contact record if the Phone field is blank.
As you can see using the screen element in we are capturing the First Name, Last Name, and Phone number of the user.
Using create record element we will create a Contact record.
To know more about create record elements check out our blog on Create Record elements in Salesforce flow
To display the error message to the user we will connect the Create Record element to a screen element as shown below:
Note that fault connectors are exclusive to Data and Action elements. If you wish to create a fault connector, you can do so by dragging from the element twice.
Display the error message on the screen element connected with the fault connector as follows.
Screen flow input from the user
Error message displayed on screen component using Fault Connector 👇
NOTE: You can use screen element to show error message only when you are creating a screen flow. For other flows type(record triggered, schedule triggered, non-triggered flows) you can Post to chatter, Send an email or create a new record to log error details.
Advantages of using Fault Connector:
- Better error handling
- Improved user experience
- Customizable error notifications
- Better flow performances