Showing posts with label Bypass validation rule for different users in Salesforce; Bypass validation rule in Salesforce. Show all posts
Showing posts with label Bypass validation rule for different users in Salesforce; Bypass validation rule in Salesforce. Show all posts

Saturday, August 13, 2022

Bypass validation rule for different users in Salesforce

 In some scenarios, we need to bypass the validation rules.

For instance, the requirement is to insert the new records in an object using data loader and the user using the data loader should not get the validation rule error.

Lets see how we can do it.

  1. Create a hierarchy custom setting, lets say the name is Validation_Bypass__c (We are creating hierarchy here because it will help us to bypass the validation based on our user or profile.)
  2. Create a boolean field in the custom setting, lets say Bypass__c
  3. Create a record in that custom setting. Make the Bypass__c checkbox = true and in the location give your name and save it.
  4. Click on Save.
  5. Create or open an existing validation rule.
  6. Modify the validation validation like this: IF($Setup.Validation_Bypass__c.Bypass__c=TRUE,FALSE,Add your existing logic here)


Please share the blog and leave a comment about your thoughts.
Click here for more blogs.


Mostly Viewed