Validation Rule Bypass Using a Custom Permission #inSalesforce

A validation rule can be created by a formula or expression that evaluates the data in one or more fields and returns a value of 'True' or 'False'. 

This include a mandatory error message so that the same is displayed to the user when the rule returns a value of 'True' due to an invalid value.

Example:

Validation Rule on Account to restrict the length of Account Number

  • LEN( AccountNumber) != 8
  • Error Message : Account Number should be of 8 digit. 


Related Scenario:

Validation Rule Bypass Using a Custom Permission

  • Create a Custom Permission named 'sampleByPass'
  • Create a Permission Set and mark the above Custom Permission Active in that.
  • Make sure you assign users to the Permission Set for whom the Validation Rule should be skipped
  • we have add like the following in validation rule-

           $Permission.sampleByPass = FALSE

Now, any users who are assigned to the Permission Set will not be subject to enforcement of the Salesforce Validation Rule and rest will get the message


Visual: https://www.youtube.com/watch?v=3o6QXxJsrCU


Reference: https://trailhead.salesforce.com/en/content/learn/modules/point_click_business_logic/validation_rules


Comments