We reference "bypasses" in a number of these conventions.

Bypasses are administrator-defined checkboxes that allow you to massively deactivate automations and validation rules with a simple click. They avoid that awkward feeling when you realize that you need to turn them off one by one so you can do that huge data update operation you're planning.

If your validation rules bypasses look like this, this is bad:
$ <> '00eo0000000KXdC' && somefield__c = 'greatvalue'

The most maintainable way to create a bypass is to create a hierarchical custom setting to store all the bypass values that you will use. This means that the custom setting should be named "Bypasses", and contain one field per bypass type that you want to do.

Great-looking bypass setup right there

This setup allows you to create bypasses either by profile or by user, like so:

This allows you to reference bypasses directly in your validation rules by simply letting Salesforce handle knowing whether or not the bypass is active or not for that specific user or profile. In the validations themselves, using this bypass is as easy as referencing it via the formula builder. An example for validation rules could be:

!$Setup.Bypasses__c.IsBypassVR__c && Name = "test"

As you can also see in the above screenshots, you can use a single custom setting to host all the bypasses for your organization, including Validation Rules, Workflows, Triggers, etc. As additional examples, you can see that "Bypass Emails" and "Bypass Invoicing Process" are also present in the custom setting - adding the check for these checkboxes in the automations that trigger emails, and automations that belong to Invoicing respectively, allow partial deactivation of automations based on criteria.

Revision #4
Created 7 July 2019 10:35:07 by Windyo
Updated 7 July 2019 11:19:45 by Windyo