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
sandy sfdcsandy sfdc 

Skip Validation when creating record from apex class

 I need to skip validation rule when im creating record from apex class and also from web services.

for ex: validation rule like: AND(ISBLANK(Phone), and in my class im not giving phone field.Even i tried according to the following link,but we can't made changes in clients validation rules.

So,please can any one help on this.
You can't skip validation rules without changing them - according to the order of execution validation rules are always run:

--- snip ---
4. Runs most system validation steps again, such as verifying that all required fields have a non-null value, and runs any user-defined validation rules. The only system validation that Salesforce doesn't run a second time (when the request comes from a standard UI edit page) is the enforcement of layout-specific rules.
--- snip ---

so there's no way in apex to set anything to skip the execution of these rules.