5 Tips to Level Up Your Validation Rules

Validation rules are an extremely powerful tool to improve data quality and enforce business rules.  Validation rules verify that data entered in a record meets the criteria you specify before the record can be saved.

With great power comes great responsibility, however.  Even in small doses, poorly executed validation rules can include side effects such as lower user adoption, increased training/documentation requirements, and reduced data quality.

But have no fear!  We’ve put together a list of five FDA-approved tips to keep your validation rule game strong.

1. Write effectively.

Validation rules can be a frustrating experience for users.  Clear and concise writing in error messages, help text, and training documentation can make that bright red text a little less stress-inducing.

Tech skills aren’t an excuse for bad writing.  Be concise, be direct, be specific, be conversational, be positive.  Emojis can be a fantastic way to humanize the experience and lighten the mood 🎉.

2. Break up complex rules.

And make sure they’re never, ever, ever getting back together.

 

Your users rely on error messages to satisfy validation rules.  If there’s five potential causes of the error, then your message will not be insightful.  As a solution, create multiple validation rules with a descriptive error message for each one.  If multiple rules are triggered, the user will receive multiple messages.

 As an alternative, you can also create a formula text field that references hidden formula checkboxes.  This text field can then guide users through the process and indicate which criteria have yet to be satisfied.

3. Consider your alternatives.

Validation rules are an intervention of last resort and may not necessarily be the best tool for the job.  Before you build a validation rule: define the problem, identify the causes, and evaluate potential solutions.

If you’re looking to improve data quality, there are countless alternatives that are less frustrating to users, such as Tom’s creative conditional record detail components or record detail tabs.  These solutions reduce scroll and hide unnecessary fields, resulting in an improved user experience that can yield benefits beyond the data requirements prescribed in validation rules.

4. Build an emergency bypass.

Few business rules are enforced in 100% of cases.  Though a bypass can take many forms, the most common example is exempting an #AwesomeAdmin like yourself by only firing when the current user’s profile is not System Administrator:

$Profile.Name <> "System Administrator"

You can exclude other groups of users by referencing $User.Id, $UserRole.Name, $Profile.Name, as well as by creating custom permissions and permission sets.  Getting leaders to be honest about exemption requirements prevents you from being forced into emergencies that require validation rule shutoffs.

5. Save time migrating data with Salesforce Switch.

Not all data needs to adhere to your Salesforce cleanliness standards, particularly if it originated in a legacy system.

Salesforce Switch allows you to easily enable and disable workflows, triggers, and validation rules across multiple objects from one screen.  This saves so…much…time migrating data – just don’t tell any developers that we sent you.

Comments

  1. Christian says:

    Nice!

    We bypass by “$User.Ignore_Validation_Rules__c = FALSE &&…..”

    and add a checkbox on the User-Object, to switch it on or of if needed

Leave a Reply

Your email address will not be published. Required fields are marked *