function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ZombiePrawnZombiePrawn 

bypassing validation rules

hi,

 

an example scenario is, i have a validation rule for object#1. now i had a trigger for object#2 that also updates the object#1

 

Is there a way to skip the validation rules of object#1(by not relying in modifying triggers) if the update is caused by the object#2?

 

 

 

thanks in advance,

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Satish_SFDCSatish_SFDC
I dont think there is any direct method to bypass validation rule.
But i can think of a workaround:

1. Create a hidden checkbox field in the Object 1 (something called bypass).
2. When the trigger in object 2 is run, also set the bypass checbox field.
3. Modify the validation rule to run only if the bypass field is true.

Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.

All Answers

Satish_SFDCSatish_SFDC
I dont think there is any direct method to bypass validation rule.
But i can think of a workaround:

1. Create a hidden checkbox field in the Object 1 (something called bypass).
2. When the trigger in object 2 is run, also set the bypass checbox field.
3. Modify the validation rule to run only if the bypass field is true.

Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.
This was selected as the best answer
ZombiePrawnZombiePrawn
Thank you Satish, really appreciate your quick response :)