Comments Off on Exceptions to Validation and Workflow Rules [Best Practices]

Exceptions to Validation and Workflow Rules [Best Practices]

Posted February 25th, 2012 in Tips & Tricks by John Coppedge

I find it very helpful to provide a method to turn off/on validation and workflow rules on a per user or per profile basis.  Advantages:

  • Data migrations and manipulation.  I was loading contact data split into two files (1st for name, 2nd for contact details), while a validation rule prevents creating a contact without a phone or email address.
  • Integration.  Often times integration should not be subjected to the same rules as a typical user.  You could hard code the integration user details into each validation rule, but that isn’t very extensible.
  • Flexibility.  You’ve got it.

 

There are two basic ways to accomplish this:

1. Add exception fields to a custom setting.  There are some complexities with this method but it is my favorite (make sure to set org wide defaults!).

2. Add exception fields to the user record.

Here’s a brief overview of the pros/cons of each:

Custom Settings User Record
Per profile & per user. Per user only.
Must be manually migrated to new sandboxes (except for full sandboxes). Carries over on user record when sandbox created.
Workflow rule conditions must be written as “when formula evaluates to true”. Workflow rule conditions can be constructed as normal.

Continue Reading »