function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Uday KUday K 

How to skip the validation rules when inserting records in test class

Hi all,

Please,can someone suggest me how to skip the validation rules when only inserting the records but not on Updating,in the test class. Is that Test.LoadData() works out in my case?

Thanks in Advance
Uday
Vinita_SFDCVinita_SFDC
Hi,

You can achieve this by creating a custom field on object involved in testing and add a logic in validation rules that when the checkbox equals TRUE then ALL validations on the OBJECT would be turned off until it's unchecked again. Now while testing set the checkbox to true.