Skip to main content
Edited for clarity, and to flesh out the answer. Also, added an ordered list of steps to follow the original poster's proposed solution.
Source Link

Let me tell you cannotIt is not possible for triggers to ignore validation rules without adding custom logic.

If the request to save a record originates outside of a Standard UI edit page, any before triggers you've defined will run prior to the execution of validation rule atrules.

Unfortunately, once all and hence validation rulethe before triggers are finished, Salesforce will always run before trigger runs, without exception, the System validation rules (ie.Best will be make a boolean field on object required fields, max length, etc.) and in a before insert trigger check that field also modify theUser-Defined validation not to execute if that boolean is tickedrules (ie. the formula-based rules you've defined).

Here is one strategy to bypass this behavior:

  1. Add a "Skip Validation" Checkbox field to the object
  2. Set the "Skip Validation" field to TRUE in a before trigger.
  3. Add logic to your validation rules so that they do not execute if "Skip Validation" is set to TRUE.

Let me tell you cannot ignore the validation rule at all and hence validation rule will always run before trigger runs .Best will be make a boolean field on object and in a before insert trigger check that field also modify the validation not to execute if that boolean is ticked .

It is not possible for triggers to ignore validation rules without adding custom logic.

If the request to save a record originates outside of a Standard UI edit page, any before triggers you've defined will run prior to the execution of validation rules.

Unfortunately, once all the before triggers are finished, Salesforce will run, without exception, the System validation rules (ie. required fields, max length, etc.) and User-Defined validation rules (ie. the formula-based rules you've defined).

Here is one strategy to bypass this behavior:

  1. Add a "Skip Validation" Checkbox field to the object
  2. Set the "Skip Validation" field to TRUE in a before trigger.
  3. Add logic to your validation rules so that they do not execute if "Skip Validation" is set to TRUE.
Source Link
Mohith Shrivastava
  • 91.9k
  • 19
  • 161
  • 214

Let me tell you cannot ignore the validation rule at all and hence validation rule will always run before trigger runs .Best will be make a boolean field on object and in a before insert trigger check that field also modify the validation not to execute if that boolean is ticked .