Final answer:
In Salesforce, triggers run before automation rules like workflow rules. The order is before triggers, validation rules, after triggers, workflow rules, assignment rules, auto-response rules, and escalation rules.
Step-by-step explanation:
In Salesforce, when a record is created or updated, there is a set sequence in which logic is applied. The sequence is critical for understanding how different types of customization interact with each other. According to the Salesforce order of execution, triggers and automation rules do not run simultaneously. Instead, the initial step in the order of execution is the before triggers, followed by validation rules, and then after triggers. If there are no workflow field updates, after triggers are the final step. However, if there are workflow field updates, those come after the initial after triggers and can cause them to fire again.
If a workflow rule updates a field, the sequence is then
- All before triggers
- Validation Rules
- All after triggers
- Workflow Rules (if the record changes and a field is updated, after triggers fire again)
- Assignment Rules
- Auto-response Rules
- Escalation Rules
Trigger first, then workflow rules.