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 of 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 useful message and connect it to the DML element.
Customize the Error Message
For 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 email
- Send Email Core Action – Use the values from variable to send an email with error details to 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 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 will 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 Fault Path to Flow Element
- Test Custom Flow Error Message
and it won’t take more than 10-15 minutes of your time
Introducing Mastering Salesforce Flows Training Course
Liked this post? We are now offering a complete self-paced, video-based training course on Mastering Salesforce Flows. The course comes with downloadable step-by-step PDF guides, unlimited access, free upgrades, area to ask questions, free preview & 100% money back guarantee. For more details, please click here.
Need Help with Flows?
Need advice on Flows? I also offer advisory & consulting services on Salesforce Flows. So, whether you want to create new Flows or migrate existing automations (Workflow Rules, Process Builder, Triggers) to Flows, I can help you analyze, design, plan & review. To initiate a discussion, please submit the contact form here stating your requirement or book a 30-minute free discovery call at this URL.
References & Useful URLs
- Customize What Happens When a Flow Fails – Help Article (5 mins) – https://help.salesforce.com/articleView?id=sf.flow_build_logic_fault.htm&type=5
- What Happens When a Flow Fails? – Help Article (3 mins) – https://help.salesforce.com/articleView?id=sf.flow_build_logic_fault_default.htm&type=5
- Configure Every Fault Path to Send You an Email (Best Practice) – Help Article (5 mins) – Configure Every Fault Path to Send You an Email (Best Practice) (salesforce.com)
- Customize the Error Message for Running Flow Users (Best Practice) – Help Article (3 mins) – Customize the Error Message for Running Flow Users (Best Practice) (salesforce.com)
- Other Examples of Error Handling in Flows – Help Article (5 mins) – Other Examples of Error Handling in Flows (salesforce.com)