You need to sign in to do that
Don't have an account?
riffindus
Validation rules/mandatory fields while inserting records in apex class
What will happen to validation rules and mandatory fields of an object when inserting records through apex class but not following validation rules or not providing the mandatory field values.
consider account object has name, city (mandatory), max_salary(has some validation rule), phone number fields.
if i insert
account s = new account (name =' bob', phone = '7896785678', max_salary='50000');
what will happen to this line while executing, will it fail because i have not provided mandatory field (city) and didn't follow validation rule for max_salary field.
All Answers
ok. Thank you for the reply. So execution of apex class will throw error before inserting the record into the database. Am i right?
You data which does not meet the criteria is not uploaded. In mast upload you get a list of records not uploaded and reason for it in a log file.
There are ways to bypass validation rule.. try to discover them..
getting csv recordd through lightning component.