Step by Step Guide to “Custom Error” in Record-Triggered Flow

A New Feature Introduced in Salesforce Winter ’24 Release

Salesforce’s Winter ’24 release introduced an exciting new element called “Custom Error” in Record-Triggered Flow. This feature enables you to display custom error messages on the UI, either as a pop-up window or as an inline error on a field. When the message is displayed, the associated record change is rolled back.

Why is this feature valuable?

This feature is particularly useful as it allows you to perform complex validations in Flows, assess the outcomes using the “Decision” element, and then display a “Custom Error” message if the validation fails. Salesforce will automatically roll back changes to the record after displaying the error message. Previously, you would have needed to write an Apex trigger to perform such complex validations.

Example and Business Use Case

In Salesforce, if you have a master-detail relationship between two objects and you delete the master record, Salesforce automatically deletes the child records as well. If you want to prevent the deletion of the master record when child records exist, this previously required writing a trigger.

With the Winter ‘24 release, you can now meet this requirement using the “Custom Error” element. In this guide, we’ll create a Record-Triggered Flow to stop the deletion of a master record when child records exist in a master-detail relationship.

Custom Error element in Record-Triggered Flow

Other Use Cases

Some other scenarios where you can utilize this feature include:

  • Creating dynamic discount validations that consider factors like customer segment, product category, and regional pricing strategies.
  • Preventing accounts from the same region or industry from being owned by competing sales reps.
  • Validating values in fields across multiple related objects.


Here are my some of my observations on the Custom Error element in the flow:

  • This element is available only in Record-Triggered flow. It is not available in other types of Flow.
  • If you add other elements (e.g., “Assignment” or DML elements) after the “Custom Error”, the flow continues the execution and commits the transaction. The error message is not shown, and the record is not rolled back.

Invest 15-20 minutes in following this guide, and you might be able to replace some of your Apex triggers. Not a bad return on investment, if you ask me.

Not an “All Access” Pass Member Yet?

Get Download Access to this & 150+ More Step-by-Step Guides with “All Access” Pass. A simple and single plan to access our entire library of courses, guides, workshops & masterclasses on Salesforce.

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, community discussion area, free preview and more. 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 schedule a discussion at this URL.

References & Useful URLs

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
Introducing All Access Pass