You need to sign in to do that
Don't have an account?
abhinav Kr
Where does Validation rule execution takes place?
Hi Everyone,
I have a query over the validation rule execution place.
I know that validation rule varifies a record before the record is saved.
For Ex:
I am creating a Custom Object named as "NewYear" with a field "Name Please" and applied a validation rule as " ISBLANK( Name_Please__c ) ".
Now when i will create a record for the "NewYear" object without specifying the "Name Please" field and hits the save button then my request goes to the Salesforce Application Server and verifes if the record request fullfills all the validation rules.
And If all the validation rules are passed then only my request will be sent to the Salesforce Database Server to create the Record for "NewYear" object.
Please comment whether my understanding is correct and do comment if i am wrong and there is some different flow is present.
I have a query over the validation rule execution place.
I know that validation rule varifies a record before the record is saved.
For Ex:
I am creating a Custom Object named as "NewYear" with a field "Name Please" and applied a validation rule as " ISBLANK( Name_Please__c ) ".
Now when i will create a record for the "NewYear" object without specifying the "Name Please" field and hits the save button then my request goes to the Salesforce Application Server and verifes if the record request fullfills all the validation rules.
And If all the validation rules are passed then only my request will be sent to the Salesforce Database Server to create the Record for "NewYear" object.
Please comment whether my understanding is correct and do comment if i am wrong and there is some different flow is present.
it's not really like stored procedures, because that (in database speak) is stored on the persistant technology, system validation is still at the logical layer in Salesforce.
All Answers
You can find the full list of the order of execution in a Salesforce transaction here:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm
(bookmark that link, it's the most useful in the world!)
You can see "user-validation" rules are run first at step 4.
This is indeed before step 19 where the data is sent to the database.
Validation rules are checked before everything like triggers and workflow because - what is the point in performing all that heavy lifting if the user-input is going to be refused anyway?
Hopefully that helps... do give that page a good read!!
Thanks for the answer,
I just bookmarked the link.
I got my answer for what i am looking for.
I have one more query:-
Is the Salesforce runs system validation each time we perform DML operation?
and if you could tell more about what is "Salesforce System Validation", is it like a stored procedure which calls itself when we perform a dml operation?
Thanks,
@bhinav
it's not really like stored procedures, because that (in database speak) is stored on the persistant technology, system validation is still at the logical layer in Salesforce.
Do you have some link to get me more on logical layers in salesforce as i did have any clue how logical layer is implement in salesforce by Salesforce.