Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to disable Validation Rule with Apex Code? I need disable a managed Validation Rule in all customer orgs.

share|improve this question
up vote 6 down vote accepted

It is common practice to have a boolean flag (say ByPass_VR__c), which can be set via Apex Code to skip it. Unless there is such a provision in this validation rule, you cant temporarily disable it via Apex code.

The only 'work around' is to set field values such that the error formula doesn't evaluate to true.


share|improve this answer
Exactly as @techtrekker said, you probably won't be able to do this since it is a managed validation rule. – Jesse Altman Feb 15 '13 at 13:41
This is correct. But I would put the Flag inside Custom Settings → this way no metter how many VR we have inside the org I can stop them in one place. – Yuval V May 12 '15 at 10:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.