Using hierarchy custom settings in validation rules

Custom fields could now be used in validation rules (indicated by $Setup). Learn how to set this up in your Salesforce org, so that it will work with the eperi sEcure Platform.

About this task

Important: Only fields accessible via the Salesforce REST API are supported by the eperi sEcure Platform.

In the following example, a custom field with the data type "checkbox" is used to disable a validation rule. Using custom fields with other data types is also possible.

Procedure

  1. Log in to your Salesforce org as Salesforce administrator.
  2. From Salesforce Setup, enter Custom Settings in the Quick Find box, then select Custom Settings.
  3. Click New.
  4. Enter the definition of the new custom setting, for example:
  5. Click Save.
  6. Click New (Custom Field):
  7. In Step 1 of the configuration wizard, select Checkbox as Data Type, then click Next.
  8. In Step 2, enter the details of the custom field, then click Next.
  9. In Step 3, click Save.
  10. In the Custom Setting Definition Detail click Manage:
  11. Click New to add a new set of data:
  12. Click Save:
    Since you left the checkbox unchecked, the value of the field should be false. You could check this in the Salesforce Workbench.
  13. Include the custom field in the Error Condition Formula of your validation rule, for example:
     AND( NOT( $Setup.CustomSettingObject__c.Custom_Field_Checkbox__c ), ISBLANK( Description )  )
  14. Synchronize the validation rule with the eperi sEcure Platform (see Enabling validation rule support for protected fields).
  15. To disable the validation rule, check the Custom_Field_Checkbox in the Custom Settings.
    The value of the custom field is now true, which disables your validation rule.

Results

You have successfully set up a hierarchy custom setting to disable a validation rule.