Skip to main content

Custom Error Component in Salesforce Flows

 


Flow has established itself as the leading declarative automation solution for Salesforce, making it a focal point for all Salesforce professionals today. Whether you require a visual tool to streamline your business processes or to effortlessly automate tasks within your Salesforce environment, the extensive range of features offered by Salesforce Flow has proven invaluable.

With the introduction of Salesforce's Winter '24 release, a set of new components is set to enhance this powerful tool. Among them, Custom Error stands out as a much-anticipated addition, poised to empower Salesforce Admins to elevate their data integrity processes by leveraging the built-in capabilities of record-triggered flows.


That's correct! While it might seem like the new component could replace validation rules, that's not the case at all. Validation rules remain highly valuable, provided your specific use case falls within their capabilities.

Up until now, when there was a need to iterate through related records, such as checking their existence or displaying an error message to prevent record deletion in certain scenarios, developers had to utilize the addError() method within a before-save trigger.

With this latest release, Salesforce professionals without programming expertise will be able to address these advanced requirements directly through a record-triggered flow. Achieving this will involve a combination of components to refine criteria, followed by the use of the new Custom Error component, which can accommodate one or multiple error messages - all readily available right out of the box.


Custom Error Component

Since the pre-release orgs have already been upgraded to Winter '24, and if you have a pre-existing one from previous releases, make sure to log in and explore this component. For those who don't have access to one, we'll walk through a practical example to see how the new addition to Salesforce Flow works in action.

The straightforward use case we're about to examine involves ensuring that when a new opportunity is created, there are no other "New Customer Opportunities" on the same account. This is essential to avoid reporting issues when distinguishing between entirely new deals and upsells or expansions. Depending on the specific requirements, this scenario can also apply to creating or updating opportunities, and in this instance, the flow is configured for Fast Field Updates.

In a sandbox environment today, achieving this would likely involve a combination of a roll-up summary field and a validation rule, done declaratively. However, what if the object in question isn't Opportunity, but a custom object with a lookup relationship or no relationship at all? Moreover, what if the scope of the check extends beyond just the immediate account but includes the entire hierarchy sharing the same "Ultimate Parent"? Let's dive into the actual flow to see how it's done!

DEMO






Thanks And Happy Coding!!!





Comments

Popular Posts

Top 100 Most common used Apex Method in Salesforce

  Here are 100 more Apex methods in Salesforce: 1.       insert: Inserts records into the database. 2.       update: Updates records in the database. 3.       delete: Deletes records from the database. 4.       upsert: Updates or inserts records into the database. 5.       query: Retrieves records from the database using SOQL. 6.       getContent: Retrieves the content of a document or attachment. 7.       getContentAsPDF: Generates a PDF file from a Visualforce page or HTML content. 8.       addError: Adds a custom error message to a record and prevents saving. 9.       start: Initiates processing in batch Apex. 10.    execute: Processes a batch of records in batch Apex. 11.    finish: Finalizes processing in batch Apex....

How to create ICS/Calendar File | Helps you to download the calendar invites

  Want to know how to create ICS(Internet Calendar Scheduling) file for Business purpose....👀    ICS (Internet Calendar Scheduling) file is a calendar file saved in a universal calendar format used by several email and calendar programs, including Microsoft Outlook, Google Calendar, Notes and Apple Calendar. It enables users to publish and share calendar information on the web and over email. Lets see the code. The code is written in lwc(Lightning web component). HTML:   <template> <div class="login-container"> <h1 style="size: 14px;"><b>Create ICS File</b></h1> <div class="form-group"> <lightning-input type="datetime" name="input1" value={EventEndValue} onchange={startDate} label="Enter Start date/time value" ></lightning-input> </div> <div class="form-group"> <lightning-input type="...

Sharing records by Apex in Salesforce

  Greetings, everyone! In today's session, we'll delve into the topic of sharing records within an Apex class. As we're aware, there exist various methods through which we can accomplish the sharing of records. We engage in record sharing primarily when the object's Organization Wide Default (OWD) settings are set to private. Sharing settings come into play when certain predefined criteria are met, allowing us to extend access to records to designated groups or roles. In cases where intricate logic is involved, manual sharing is employed. While this approach proves beneficial for specific records, instances where a multitude of records require automated handling, Apex sharing becomes the preferred solution. Salesforce offers a 'Share' object for each type of object, with distinct naming conventions: For standard objects, it's 'StandardobjectName+Share', such as 'AccountShare' for the 'Account' object. Custom objects follow the pattern...

Login Salesforce Without Credentials(Without UserName and Password)

  Want to login into Salesforce without credentials. Please follow the below STEPS: STEPS:-  1)  Goto to setup  --> Open Developer Console. 2) Goto debug --> Open Execute Anonymous Window --> It will open the pop. 3) Please write the below code in Anonymous window.       String sessionId = UserInfo.getOrganizationId() + '' + UserInfo.getSessionId().SubString(15);      System.debug('$$$$ Session Id ' + sessionId); 4) Click on Execute and filter the debug. You can see one session Id with Organization Id. Now, we have to copy the debug session Id and create one login URL. Steps to create Login URL: 1) Copy the Salesforce URL. Please refer the screenshot shown below. 2) Now concatenate the session Id with the salesforce URL and your Session Id Will look like below. https://d5g000004zfq2eai-dev-ed.lightning.force.com/secur/frontdoor.jsp?sid=00D5g000004zfQ2EAI!AQgAQKzTcnQTifXpRnQ7DgECtk_rv.w9BT5FoPEAmoy_UrgG4HJ6B9YFpQ2LVlmnJhBrYPSf8cI...

Salesforce Flow Updates – Spring’25 Release

  In this blog, we’ll dive into the Salesforce Flow Updates introduced in the Spring ’25 Release. We’ll explore their practical applications and how they enhance user experiences. This release emphasizes improved usability, efficiency, and functionality in Salesforce Flows. With upgrades like enhanced Flow Builder features, reactive screen actions, and progress indicators, Spring ’25 takes automation to the next level. Let’s explore each Salesforce Flow Updates 1. View Flow Versions Side by Side The Spring ’25 update introduces the ability to open flow versions in separate tabs directly within the Flow Builder. This feature allows you to compare different versions side by side on the same canvas, streamlining the debugging process and improving efficiency. 2.Smarter Search in Resource Picker The resource picker now features enhanced nested search functionality, simplifying the process of finding the right resources. Whether you're looking for record variables, custom labels, or glo...