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
Kanhaiya Yadav 4Kanhaiya Yadav 4 

which one execute first validation rule or before trigger


  I am little bit confuse.
  which one execute first validation rule or before trigger.
HI Kanhaiya Yadav,
  1. System Validation rule (required field, field format) (SV)
  2. Before Triggers are executed (BT)
  3. Custom Validation rules are checked (CV)
  4. After Triggers are executed (AT)
  5. Assignment Rules are executed (AR)
  6. Auto-Response Rules are executed (ARR)
  7. Workflow Rules are executed (WR)
  8. Before and after triggers are executed one more time if the workflow rule updates a field (BT & AT)
  9. Escalation Rules are executed (ER)
  10. Parent Rollup Summary Formula or Cross Object Formula fields are updated in the respective objects. (RSF, COF) (These parent records also goes through the entire execution order)
  11. Criteria Based Sharing rules are evaluated (CBS)
  12. Any Post-Commit Logic is executed (PCL)  (like sending an email)
To remember this sequence you can memorise the following.
SV -> BT -> CV -> AT -> AR -> ARR -> WR (BT, AT) -> ER -> RSFCOF -> CBS -> PCL
I think this may help you.
DeepthiDeepthi (Salesforce Developers) 
Hi Kanhaiya,

Before Triggers are executed before the execution of Validation rules. 
For reference, you can check the below article about Order of execution in Salesforce:

Let me know if you need any further assistance!
Best Regards,
Hi Kanhaiya

1-System validation rules are fire 
2 before trigger 
3-Custom validation rules will be fired

if this was helpful don't forget to mark as best answer 

Thank you 
Avaneesh Singh
buggs sfdcbuggs sfdc

here System Validation rule is which comes default like on contact object lastname is mandatory to fill,its a system validation,
so if you are talking about system validation it will fire before trirgger.
If its custom validation(which we create) it will after before trigger.
Kanhaiya Yadav 4Kanhaiya Yadav 4
Thanks .
But in the following question.
Q. :- In which order does Salesforce execute events upon saving a record?
1.Before Triggers; Validafion Rules; Aher Triggers; Assignment Rules; Workflow Rules; Commit

2.Validafion Rules; Before Triggers; Aher Triggers; Assignment Rules; Workflow Rules;

My Answer is : 1
But some peopele say: 2

System validation will execute before trigger and custom validation which you will create will be fire after before trigger 
I hope you understand system validation and custom validation 
Kt YadavKt Yadav
Below is the simple example to explain order of execution for  trigger, workflow, field update and validation rule.
Peter GruhlPeter Gruhl
The Order of Execution information has changed with the Spring '20 Version release of Salesforce.  Before-Save Update Flows are now available that execute Before the Before Triggers.  Consult with the Apex Developer Reference, botton of page 233 and continuing, for the exact Order of Execution.