Display Custom Error Messages in Record-Triggered Flows

Display Custom Error Messages in Record-Triggered Flows

Salesforce introduced a new element called Custom Error in the Winter '24 release. This element lets you display error messages in record-triggered flows. There was already a workaround to achieve this using a checkbox field that fires a validation rule. However, you had to create a checkbox field and a validation rule for each error message that you wanted to display. Moreover, this workaround worked only in before save record-triggered flows (excluding before delete).

Using fault paths for error handling is very important. Using fault connectors, users can understand what went wrong and take actions about it. If it is a screen flow, you can connect the fault connectors to a screen and display an error message. To display the actual error message, you can simply use {!$Flow.FaultMessage}. On the other hand, if you handle errors in record-triggered flows, there was no way to display an error message (except for the workaround for before save record triggered flows). The new Custom Error element solves this issue. You can use this element in fault paths to display error messages in record-triggered flows.

How to Use the Custom Error Element with Fault Paths

Let's see how to use this element with fault paths. The purpose is to display an error message if something goes wrong and the flow fails.

Here is an after save record-triggered flow that closes all the related case records of an account. However, there is a validation rule that fires. Here is how the error looks like without the Custom Error element. As you can see, the flow fails with a long and ugly error message.

Flow Error without Handling Errors

If you use a fault path without the Custom Error element, user doesn't see an error message. This is not what you would want to do, it is important to let the user know that something went wrong.

Therefore, add a Custom Error element and use {!$Flow.FaultMessage} as the error message. Optionally, you can display a custom message too. If you know the main reason for the failure, you can display the message as an inline error on a field. Moreover, you can click Add Error Message in order to add more error messages.

Using the Custom Error Element

As you can see, the error message is more meaningful now.

Error Message Using FaultMessage

How to Use the Custom Error Element to Build Validations

As mentioned before, there is no need to create a checkbox field and a validation rule for complex validations. For example, here is a before save record triggered flow that displays an error message if the case is closed and there is no file related to it.

Custom Error Element to Display Validation Errors

As you can see, it displays a custom error message.

Display Custom Error Message

Let's assume that it is an error related to a field. You can display the error message as an inline error on a field. Plus, you can display field values from your resources.

Custom Error Message on a Field

How to Use the Custom Error Element to Block Deleting Records

Although marking a checkbox that fires a validation rule was a good workaround for custom validations, it wasn't possible to block deleting records. Therefore, you had to use a before delete trigger that displays an error message. Starting with the Winter '24 release, you can easily do this using the Custom Error element.

Here is a before delete record-triggered flow that blocks deleting an active account. You can see that it is very easy to implement this. Before the Winter '24 release, you needed a developer to write an Apex trigger for this.

Record Triggered Flow to Block Deleting Record
Custom Error Element to Block Deleting Account


Custom Error element is a very useful feature that Salesforce released in Winter '24 release. There are many use cases and it solves many problems that admins had for a while. It is safe to say that this new element is a game changer.


    • Hi,
      I have a prerelease org, which means that I get the new release a few weeks earlier than the others.
      This feature is included in the Winter '24 release.

  1. Great article, Yumi! Glad to see this new feature available with Winter 24 release. The "block deleted records" is a great use case for this functionality!

  2. Nice post, Yumi. When I tried the fault line message on a failed create, I got a red box across the top of the page. The message disappeared by itself before I could read it after a few seconds. I don't see a lot of consistency with this functionality. Hopefully, in GA it will be better.

  3. Do you know if you use a custom error message in a fault path, will the entire transaction rollback? Or will any previous DML elements that successfully executed prior to the DML element that faulted stay committed to the database?

3 Trackbacks / Pingbacks

  1. New Flow Features of Winter '24 Release - Salesforce Time
  2. Using Flow to Prevent Record Deletion - Salesforce Time
  3. 10 Salesforce Flow Tips and Best Practices - Salesforce Time

Leave a Reply

Your email address will not be published.