Tuesday, April 5, 2011

Salesforce Order of Execution

Hello All,
Today we are going to understad the Salesforce order of Execution,ie when we done some DML oprstion as insertupdate, or upsert statement, Salesforce performs the following events in order
The browser runs JavaScript validation if the record contains any dependent picklist fields and then Salesforce executes these events on the server. The validation limits each dependent picklist field to its available values. No other validation occurs on the client side.
Here is order of execution in salesforce
  • The original record is loaded from the database.
  • System Validation Rules.
  • Executes all before triggers.
  • Custom Validation rules.
  • Executes duplicate rules.
  • Saves the record to the database, but doesn’t commit yet.
  • Executes all after triggers.
  • Executes assignment rules.
  • Executes auto-response rules.
  • Executes workflow rules.
  • If there are workflow field updates, updates the record again.
  • If the record was updated with workflow field updates, fires before and after triggers one more time. Custom validation rules, duplicate rules, and escalation rules are not run again.
  • Executes processes and flows launched via processes and flow trigger workflow actions.
  • Executes escalation rules.
  • Executes entitlement rules.
  • If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.
  • If the parent record is updated, and a grandparent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the grandparent record. Grandparent record goes through save procedure.
  • Executes Criteria Based Sharing evaluation.
  • Commits all DML operations to the database.
  • Executes post-commit logic, such as sending email.

We have diffrent order of Exisuxtion as well as ,we can see these details over the below links

2 comments:

joshi's said...

Hi there.. Very Very vital Info..Especially for Dev401 users:)..
Thank you..

Navees said...

I think user defined validation happen before "before trigger"