Free Salesforce Developers Tutorials >

Chapter - 9 Apex Triggers >

Trigger Order of Execution

Trigger Order of Execution

What You’ll Learn


tickOrder of Execution in Apex Trigger

S2 Labs

Trigger Order of Execution In Apex

In Salesforce there is a particular order in which events execute whenever a record is changed or inserted. Following are the steps of trigger execution:

Step 1:  Load the original record or initialize on insert.

Step 2: Override the old record values with the new values.

Step 3: Execute all before triggers.

Step 4: Run the system & user-defined validation rules.

Step 5: Save the record but do not commit the record to the database.

Step 6: Execute all after triggers.

Step 7: Execute the assignment rules.

Step 8: Execute the auto-response rules.

Step 9: Execute the workflow rules.

Step 10:  If there are workflow field updates then execute the field update.

Step 11: If the record was updated with a workflow field update then execute before and after triggers created on the object in the context again but only once.

Step 12: Execute the processes and flows on that record.

Step 13: Execute the escalation rules.

Step 14: Update the roll-up summary fields & cross-object formula fields.

Step 15: Repeat the same process with the affected parent or grand-parent records.

Step 16: Evaluate criteria-based sharing rules.

Step 17: Commit all DML operations to the database.

Step 18: Execute post commit logic such as sending emails.

Salesforce Developer

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Download Now

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners . But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Post a Comment

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