Salesforce Order of Execution

Malik Ifrahim
3 min readNov 1, 2020

--

Order of Execution in Detai

Salesforce has given a lot of options before committing the record to the database these options can be utilized by the developers and administrator to meet the business requirements. for e.g a simple validation name to contain only Characters also these stages can ensure the validation of the data, commit to the database, operations performed before/after the record committed into the database.

Salesforce Order of Execution (Detail Description)

System Validations

System Validations are the ones which are enforced by salesforce for example fields should only contain characters number should be in the following format and email validations format.

Execute All Before Trigger

The execution of the Trigger runs the apex code business logic mostly used to update and validate records before committing it to the database.

Custom Validations

We can create our own validations rule to prevent users from inserting bad data into salesforce for e.g AccountNumber must be 8 characters long.

Execute Duplicate Rules

Duplicate rules are the one which prevents similar data to be inserted again for e.g your business rule is the Account Name should always be different to be inserted to be unique. You can create a duplicate rule to prevent the creation of multiple accounts with the exact same name.

Save the Record but doesn’t Commit

The record is saved to the database but the transaction is not completed so it’s not committed to the salesforce.

Execute After Trigger

After triggers are used access fields and values that are set by the system but the record which fire the after trigger is “readOnly”

Assignment Process

This used to automate business processes for example use case assignment rules that is how cases are assigned to users or assigned to users.

Execute Auto Response Rules

Auto response allows us to send emails to lead or case submission based on the criteria which we set up in the auto response rule but at a time one rule can be activated for a case and lead.

Execute Workflow Rules

A workflow is a declarative approach which allows us to automate the business process for e.g Notify via Email the owner when the high priority case is created with accounts with platinum SLA

  1. If workflow update and field
  2. If the record was updated because of the workflow custom validation, duplicate rules, and escalation rules does not run again, and triggers before and after will update (only and only one more time)

Execute Processes

Execute the lightning flow orders but not in the guarantee order

  1. Processes
  2. Flow Launched by Processes
  3. Flow Launched by Workflow Rule

Execute Escalation

An escalation rule automatically reroutes a case and can notify a user if the case remains open after a certain period of time has passed

Execute Entitlement Rule

Entitlement processes are timelines that include all of the steps (or milestones) that your support team must complete to resolve cases.

Rollup Summary

  1. If the record contains a roll-up summary field or is part of a cross-object workflow, perform calculations and update the roll-up summary field in the parent record. The parent record goes through the save procedure.
  2. 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 the save procedure.

Execute Criteria based Sharing

Commit to Database: Commit to the database

Execute Post Commit Logic: Such as send an Email

--

--

Malik Ifrahim
Malik Ifrahim

No responses yet