function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

execution order of workflows, apex trigger and validation rules


I'm sure this question has been asked from time to time, but I could not find the answer with my search strings:
Is there a specified execution order of apex triggers, workflow rules and validation rules?
I have some problems that depend on this execution order and need to know in wich squence these were executed.

Thanks for your help!
Best Answer chosen by Admin (Salesforce Developers) 
X-Squared On Demand has the full salesforce order of execution list from the Apex documentation posted here:

All Answers

Jeff TalbotJeff Talbot

From Help and Training:

Salesforce processes any rules in the following order:

  1. Validation rules
  2. Assignment rules
  3. Auto-response rules
  4. Workflow rules (with immediate actions)
  5. Escalation rules

Workflow field updates that run based on an approval process or time-dependent action do not trigger any rules.

As a side note, formula fields are processed between 1 and 2. Someone else will have to reply about Apex triggers, I'm not certain.
The order of execution (with Apex) is as follows:

1. All before triggers execute
2. System validation occurs, such as verifying that all required fields have a non-null value, and running any user-defined
validation rules
3. All after triggers execute
4. Assignment rules execute
5. Auto-response rules execute
6. Workflow rules execute
7. Escalation rules execute
8. Post-commit logic executes, such as sending email
Anyone have any ideas around how to order workflows rules (with immediate actions) that are related to a custom object. We have a record get created via the API and assigned to a queue then we have 2 workflows that need to immediately kick-off but in a specific order.
1) Change the Owner of the record
2) Fire off an email
#2 has to happen after #1 because the email template needs to populate with the new record owner information on it. Any ideas are greatly appreciated.
X-Squared On Demand has the full salesforce order of execution list from the Apex documentation posted here:

This was selected as the best answer

Hi George,


I have the same problem... Did you resolve it?





Hi Beatriz,


I think you should use a kind of synchronization mechanism. You could create a further custom field lets call it sync__c.

The first workflow gets a second imdiate field update and sets sync__c to true. The second workflow rule looks for sync__c equals true and fires the email (or what ever you like). The second workflow has to reset the sync__c to false with an other imdiate field update.


Lets take again George example. If the change of ownership will only be triggered by this first workflow you could use the ISCHANGED(OwnerId) function in the secound workflow rule to make sure the ownerid has been changed. This would be a kind of synchronization mechanism as well.




new joinersnew joiners

what are escalation rules?


in workflow triggers execute first or after workflows plz help me i want to know


HI i just woud like to know that cn we change the order of execution of triggers..while executing??

Hi all, you can find the execution order below:
1) Fetch the data
2) System validation
3) Execute before triggers
4) System and custom validations
5) Save the data
6) After triggers
7) Assignment rules
8) Auto-response rules
9) workflow rules
10) workflow field update - if record is updated then before update triggers and after update triggers are called
11) escalation rules
12) entitlement rules
13) Rollup summary field
14) criteria based sharing rules
15) commit
16) send email

Mark as correct answer if you find it useful.

Sandeep Kokate
Here we have a new addition here. We now have Before save flow which executes before triggers.
You can find updated details here: