Order of Execution in Salesforce
Updated on 07th Jun, 21 97 Views

As per Gartner, revenue in the Enterprise Software segment is expected to reach more than US$230 million by the end of 2021. Businesses are shifting more and more towards technological CRMs to keep up in today’s tech era.

Salesforce has a bunch of rules that can be defined on objects and fields. For example, you can define validation rules, workflow rules, escalation rules, auto-response rules, triggers, etc.

If you are a consultant, developer, or architect, it’s essential for you to understand the order in which the rules and triggers are executed. Let’s see the order of execution in Salesforce:

Watch this tutorial on ‘Salesforce Developer Training for Beginners’:

Become a Salesforce Expert

  1. Load the original record from the database and load the record for the upsert statement.
  2. Load the new record field values from the request and overwrite the old values.
    If the request comes from a standard UI edit page, Salesforce runs system validation to check the record for:
    • Compliance with layout-specific rules
    • Required values at the layout level and field-definition level
    • Valid field formats
    • Maximum field length
  3. Whenever a request comes from other sources, e.g., Apex application or a SOAP API call, Salesforce validates only the foreign keys.
  4. Executes record-triggered flows that are configured to run before the record is saved.
Full save cycle
  1. Executes all before triggers.
  2. Run most system validation steps. Verify that all required fields have a non-null value and run user-defined validation rules.
  3. Executes duplicate rules. 
  4. Saves the record to the database, but doesn’t commit yet.
  5. Executes all after triggers.
  6. Executes assignment rules.
  7. Executes auto-response rules.
  8. Executes workflow rules.
  9. Executes escalation rules.
  10. If there are workflow field updates, update the record again.
  11. If the record was updated with workflow field updates, fires before update triggers and after update trigger one more time (and only one more time), in addition to standard validations. 
  12. Executes processes and flows launched using flow trigger workflow actions.
  13. Executes entitlement rules.
  14. Executes record-triggered flows that are configured to run after the record is saved.
  15. 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 the save procedure.
  16. 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. 
  17. Executes Criteria Based Sharing evaluation.
  18. Commits all DML operations to the database.
  19. Executes post-commit logic, such as sending an email.

Enroll today in Salesforce Training in London to get a clear understanding of Salesforce!

Conclusion

As we have discussed in order of execution there is a lot more to understand than triggers run before workflows. Understand the flow and apps will have more scalability and reliability. Start learning Salesforce and its mechanisms by enrolling in Salesforce Certification Course.

For more information on Salesforce, visit our Salesforce Community

Course Schedule

Name Date
Salesforce Certification 2021-09-18 2021-09-19
(Sat-Sun) Weekend batch
View Details
Salesforce Certification 2021-09-25 2021-09-26
(Sat-Sun) Weekend batch
View Details
Salesforce Certification 2021-10-02 2021-10-03
(Sat-Sun) Weekend batch
View Details

Leave a Reply

Your email address will not be published. Required fields are marked *

Looking for 50% Salary Hike ?

Speak to our course Advisor Now !

Associated Courses

Subscribe to our newsletter

Signup for our weekly newsletter to get the latest news, updates and amazing offers delivered directly in your inbox.