Sign up ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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

1 Answer 1

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 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.