Fault Paths in Salesforce Flow: Handle Flow Errors Efficiently

When we create a flow in Salesforce, we often encounter situations where a flow attempts to automate a process but fails due to reasons such as missing or incorrect field data.

In this situation, without error handling, the flow stops, and we are unable to determine the cause of the error. Here, we can utilize the fault paths in Salesforce flow.

In Salesforce flows, a fault path can catch the error and store it in a custom object or send an email alert to the administrator, allowing them to resolve the issue without stopping the entire flow.

In this tutorial, we will learn how to add fault paths in Salesforce Flow to identify the exact error, understand their importance, and utilize them effectively with a real-world example.

What are Fault Paths in Salesforce Flow?

When we create the flow and debug it, it will work fine at that time. However, if any data is changed outside of the flow we created, the flow does not execute properly, and the automated process breaks silently.

Additionally, we didn’t receive the proper error message, and we cannot easily identify which element is causing the issue. For that, we have a feature called Fault Paths in Salesforce Flow.

Similar to a try-catch block in exception handling used in programming languages, we add fault paths to the element where we are using DML operations or where we have developed logic for the flow.

If the flow fails, these fault paths provide us with proper details about the error. Using that, we can easily find the error and resolve it to execute the flow smoothly.

Where can we display errors using Fault Paths in Salesforce Flow?

To display the error that we catch from the fault paths, we can use the following options:

  1. Screen Flow: When creating the screen flow and displaying an error, we can add a fault path to the element where the error occurs. Then we can add a screen component that displays a proper reason or error message on the screen.
  2. Send Email: Using the Send Email action, we can send a fault error message to the admin or a specific user.
  3. Store Error: To display errors instead of just showing them, we can store the error details in an object with the flow name, error message, and other relevant information. This is very helpful for tracking errors, rather than frequently debugging the flow and checking for errors.

Add Faults Path in Salesforce Flow

Below, I will explain in detail how we can add fault paths in Salesforce Flow. Before that, we will understand the use case and the prerequisites to create the flow, and then we will develop the flow accordingly.

Use Case:

To automate the applicant screening process and handle errors effectively using fault paths, I have created a custom object named Job Application__c.

Whenever a new job application record is submitted, the system should:

  • Assign a task to the active Hiring Manager user. If the user is inactive, send an email to the owner of the job application record.
  • If the user is active, then create the task for that user. Also, add the fault path for the creating task element.
  • If an error occurs while creating a task, record the