When the field is checked the validation rule will be disabled, for the running user or in this example, their profile -
The rule can also be disabled for a whole Salesforce org -
AND(
/* the below is the reference to the Val_Rule_Cntrlr__c custom setting's checkbox field All_Opportunity_Disabled__c
*/
$Setup.Val_Rule_Cntrlr__c.All_Opportunity_Disabled__c = FALSE,
/* the below is the remainder of the validation rule's formula
*/
CloseDate < TODAY()
)
In the above rule, both pieces of criteria must evaluate to TRUE
in order for the rule to be triggered.
Since All_Opportunity_Disabled__c
checkbox will evaluate to TRUE
when the running user's profile is System Administrator, the rule will evaluate to FALSE
.
The same approach can be applied in order to deactivate Workflow Rules.