Blog
02/10/2023
Winter 24- custom error message using Record Triggered Flow
Quite a buzz going around in the Salesforce ecosystem about the Winter-24 release features especially related to lightning flow. So let’s discuss one of the features i.e. Display custom error messages using Record Triggered flow.
Use Case :-
Universal Containers has implemented CPQ & they are heavily using Quote Line Groups so that the Sales Rep can categorise the quote lines based upon the family of products like software, hardware or support products. Dates play a crucial role while doing the quotation in CPQ, so the business came up with a requirement, i.e. Quote Line Group Start Date & End Date should lie in between the Quote’s Start Date & End Date.
Implementation
One can choose either Apex Trigger or Record Triggered Flow to implement the solution, but one of the developers decided to use Record Triggered Flow using the Custom Error Element introduced by Salesforce in the Winter-24 release.
- Setup -> Quick Find -> Flows
Navigate To Flows
2. Click on New Flow -> Choose Record Triggered Flow -> Create
New Flow
Record-Triggered Flow
Note: Custom Error Element is only available in Record Triggered Flows.
3. Configure the Start Element as shown below:-
4. Use the Decision Box Element to compare the Quote line Group dates with Quote Dates.
5. Select Custom Error Element & Configure to display the error message as shown below:-
Choose Custom Error
Variable to Store the Error Message
Configure Custom Error Element
Points To Remember :
- Error Messages can be visible either on a particular field or on the record page.
- You can add multiple error messages when it comes to field-level visibility.
6. Save -> Activate & Test out the whole functionality.
Save Configuration
Activate Flow
Display Error Message
Notes:-
- The above image clearly shows the quote line group start date is 24th August, which is before the quote start date. That’s the reason the system is not allowing us to save the configuration.
Limitations:-
- Do not use any DML or Assignment Element after the Custom Error Element. If you do so, then you won’t be able to see the validation message since flow bypasses the custom error element and executes the DML or Assignment, whichever is configured.
Demo:
Dixit Khurana
Senior Salesforce Developer
Read next
04/10/2023