How to make trigger bypass validation rules?


 Add a dummy checkbox field that is not visible to anyone.

 Let the Validation Rule bypass the record if that checkbox is true. Now, in your trigger before you update oppsToUpdate, first update that dummy-Checkbox to true. In this way, the validation rule will be bypassed. Also, make sure you make the checkbox false as soon as the trigger does its action. In order to do this, you can create a workflow that will do the field update of that dummy checkbox to false whenever the value is true.

Comments

Popular posts from this blog

Apex Trigger Framework in Salesforce with best practise

Apex Classes as REST Web Services in Salesforce

Action tags in VisualForce Salesforce