Order of execution in Salesforce

1. System Validation Rules.

2. Executes all before triggers.

3. Custom Validation rules.

4. Executes all after triggers.

5. Executes assignment rules.

6. Executes auto-response rules.

7. Executes workflow rules.

8. If there are workflow field updates, updates the record again.

9. If the record was updated with workflow field updates, fires before and after triggers one more time. Custom validation rules are not run again.

10.  Executes escalation rules.

11. 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.

12. If the parent record is updated, and a grand-parent 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. Grand-parent record goes through save procedure.

13. Executes Criteria Based Sharing evaluation.

14. Commits all DML operations to the database.

15. Executes post-commit logic. Ex: Sending email.

Cheers!!!

5 comments:

  1. Thank you very much for the info.

    ReplyDelete
  2. you have missed custom validations after 'after triggers'

    ReplyDelete
  3. how many times workflow field update will be called in triggers

    ReplyDelete
    Replies
    1. Depends upon the re-evaluate check box. The Re-evaluate should not cause recursive issue.

      Delete
  4. Very simple and lucid note and very easy to grab. Thanks

    ReplyDelete