Error detection is defined as the ability to find and report errors. Validation rules, flows, and apex classes can all report errors. In all cases, remember that a good user experience means you don’t just report the error. You also need to provide guidance on how to avoid or correct the error.

Also keep in mind that not all errors will be displayed to the user in real-time. This is especially true for integrations and data migrations.

For example, if a validation rule enforces contacts to always have a first name:

  • Bad error message: “This field is required.” This is bad because when doing data loads, “This field” doesn’t indicate which field is causing the error.
  • Good error message: “First name is required.”
  • Better error message: “First name is required. Use ‘Unknown’ if one is not available.”

Error correction is defined as the ability to fix errors. A lot of consultants forget or don’t bother with offering an easy way to correct mistakes. But you’re better than that, right?

For example, let’s say a record-triggered flow processes some bad data, and a fault path is called. The flow sets an error message on the related object. Now, once the user reads the error message, is there an easy way for them to correct the issue and re-run the flow?

One way to handle this is to offer a button that calls a screen flow. The screen flow and the record-triggered flow both call the same subflow, which performs the actual logic.

The takeaway
When designing and building, be sure to offer both error detection and error correction. Your users will thank you for it.

Category:
Salesforce