The principle of Help Users Recognize, Diagnose, and Recover from Errors states, “Error messages should be expressed in plain language (no error codes), precisely indicate the problem, and constructively suggest a solution.”
To implement this principle,
- Use traditional error-message visuals, like bold, red text
- Tell users what went wrong in language they will understand – avoid technical jargon
- Offer users a solution, like a shortcut that can solve the error immediately
In terms of Salesforce, here are some specific scenarios.
Make sure all DML operations (get, update, insert, delete) in flows have a fault path. This includes record-triggered flows, which can log errors to a custom object.
In screen flows, preserve the user’s data. For example, let’s say the user enters information in several fields on page 1, then moves to page 2 and receives an error. Upon returning to page 1 to correct the errors, be sure to save the values they’ve already entered.
For error messages in screen flows and validation rules, be sure to explain what the user did incorrectly, and what are the steps to resolve the error.
Example: Instead of displaying, “There was an error” use, “Customer Number should be 8 characters and start with the letter ‘C’. Example: C0000001.”
Also, in validation rules, be sure to explicitly mention the field name in the message. For example, don’t say, “This field is required”. Instead say, “Customer Number is required”. This is because validation rules can be triggered when importing data. Without mentioning the field name, the user won’t know the actual cause of the error.
Further, place the validation rule error message next to the field that caused the issue.
The tone of error messages should be relatively empathic, helpful, and concise.
The takeaway
No matter how well we plan our implementation, users will always make mistakes. Useful and positive error messages will help them get back to what they were trying to do without lowering their confidence.