One of top feature of Salesforce Winter 24 Release is now you can create a Custom Error Messages for Record Triggered Flows. Finally Salesforce implemented the Allow customization of error messages for record-triggered flows idea from IdeaExchange.
What is Custom Error Messages Element?
Custom Error Messages Element let you create error message for your end to show on Salesforce Flow. The associated record change is rolled back. Error messages can be created for before-save and after-save flows.
When to use custom Error Message?
Best use case of using custom error messages element is for doing any DML on a Record Triggered Flows and show customize message to end user. Before this when flow failed there was not possible to show user friendly message to end user. Now with this you can display a specific error message.
How to Display Custom Message in Flow
Follow below step by step process to add the custom error component in flow.
1. Add Custom Error Message Element
First thing first you need to add custom error message element in your flow.
2. Choose Where to display the error message
Then you need to select where you want to show error message. There are two option is “In a window on a record page” or “As an inline error on a field”.
3. Enter the error message
Then enter the error message in Error Message box.
To handle then unexpected error you can use fault Path to add Error Message.