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, escalation rules, auto-response rules, triggers, and workflow rules in Salesforce, etc.
If you are a Salesforce 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’:
Preparing for a Salesforce Interview! Check out our Top Salesforce Interview Questions and Answers.
- Load the original record from the database and load the record for the upsert statement.
- 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
- Whenever a request comes from other sources, e.g., Apex application or a SOAP API call, Salesforce validates only the foreign keys.
- Executes record-triggered flows that are configured to run before the record is saved.
- Executes all before triggers.
- Run most system validation steps. Verify that all required fields have a non-null value and run user-defined 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.
- Executes escalation rules.
- If there are workflow field updates, update the record again.
- 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.
- Executes processes and flows launched using flow trigger workflow actions.
- Executes entitlement rules.
- Executes record-triggered flows that are configured to run after the record is saved.
- 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.
- 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.
- Executes Criteria Based Sharing evaluation.
- Commits all DML operations to the database.
- Executes post-commit logic, such as sending an email.
Enroll today in Salesforce Training in London to get a clear understanding of Salesforce!
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