+ Start a Discussion
CRMfusion - GWCRMfusion - GW 

Turn off data validation rules

Is there any way in the API to disable all data validation rules for the current session?
 
If not this would be a very important tool espcially in the case of Merge and LeadConvert calls when bad data is merged with bad data.  Ideally we would have the ability in the header to turn off the validation rules for the current session.
 
Glenn Wilson
Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox
Although you can't disable them right now via the API for a session, it's possible to write your validation rules to include an explicit dependency on the user's profile or name to prevent the validation from occuring. Usually, you can do that by wrapping this small piece of code around your validation rule:

And($Profile.Name <> "System Administrator", rest of validation rule here)

This way, system administrators (or another named profile) won't get caught up in the rules and will be able to proceed normally.

~ sfdcfox ~

All Answers

natemanleynatemanley
I have run into this very need.  Did you ever get an answer to this?
CRMfusion - GWCRMfusion - GW
The answer was NO but they are looking into it for a future release.
 
My guess is that with APEX that there will be a need for a new layer that will restrict rules/triggers from being fired for code based application.
 
Please drop an email to sfdc (email me at glenn.wilson@crmfusion.com if you need a contact to send the request to) and indicate the importance of this matter.
 
Cheers;
GlennW
natemanleynatemanley

Thanks for the update.  I will definitely check in with our Success Managers at SF.  Probably check out the idea exchange too.

Interestingly enough when I ran into this issue I noticed that some our older integrations are still using version 6 of the API and the validation rules do not seem to fire in the older version.  So for now we can get around it but at the same time this is not very ideal as we need to keep pace better on our end.

Thanks,
Nate M

sfdcfoxsfdcfox
Although you can't disable them right now via the API for a session, it's possible to write your validation rules to include an explicit dependency on the user's profile or name to prevent the validation from occuring. Usually, you can do that by wrapping this small piece of code around your validation rule:

And($Profile.Name <> "System Administrator", rest of validation rule here)

This way, system administrators (or another named profile) won't get caught up in the rules and will be able to proceed normally.

~ sfdcfox ~
This was selected as the best answer
Slaviša MaslićSlaviša Maslić

Be careful if there are Administrators using different Language setting, as the name for the profile "System Administrator" is translated and therefore it might happen that the validation still applies for an System Administrator which has set the language to e.g. German. We solved it with a checkbox on the user object which we check on in the validation rules: if TRUE then ignore the validation rule

 

Cheers

Ezra Kenigsberg 6Ezra Kenigsberg 6
Here's a good way to bypass Validation Rules for individual records (https://sites.google.com/site/ezrakenigsberg/blog/abetterwaytobypassdatavalidation)