Custom Error Component in Salesforce Flows

Blog > Custom Error Component in Salesforce Flows

Custom Error Component in Salesforce Flow

Flow is the go-to declarative automation tool for Salesforce professionals, offering seamless solutions for business processes. In the latest Winter '24 release, a game-changer is introduced: Custom Error. This feature empowers Salesforce Admins to enhance data integrity processes through out-of-the-box functionality in record-triggered flows.

In the past, tackling complex tasks like looping through related records or preventing record deletion in specific scenarios required developer expertise using the addError() method in a before-save trigger. Now, with the latest release, Salesforce professionals, even without coding skills, can seamlessly address advanced requirements using a record-triggered flow. This is made possible by combining components to refine criteria, coupled with the new Custom Error component, offering out-of-the-box solutions with one or multiple error messages.


Custom Error Component Example

Custom Error Component in Action

Let's try out a straightforward example: ensuring that when creating an opportunity, there are contacts on the same account. This ensures we have a primary contact before creating the opportunity. Depending on the need, this could be a 'create or update' situation, and in our case, the flow is set up for Fast Field Updates.

Typically, in a sandbox, we might use a roll-up summary field and a validation rule for this purpose. However, what if it's not the Opportunity object but a custom one with a lookup relationship or no relationship at all? Also, what if we want to check not just the direct account but the entire hierarchy under the same "Ultimate Parent"? Let's dive into the actual flow to explore this!



As demonstrated in the video, you can observe that not only is it possible to include and personalize multiple messages within the same component, but you can also individually choose their positions.


Custom Error Component in Flow
Custom Error Component Usage

In summary, the introduction of the Custom Error component expands the possibilities considerably, offering a straightforward solution with the flexibility to gradually enhance complexity.

Crafting Tomorrow's Solutions Today.

Got something on your mind! Connect with us.

Fill out the following form & we will get back to you.