i need a small clarification on the order of execution in salesforce. Like i have trigger and Workflow field update both on Record insert operation/event, so in this case the final value will be from Workflow ,which is working fine.

But in case of Record update operation/event, its taking the final value from trigger(and not from WF field update).

As per the documentation ,Workflow fires after the trigger, then why in the Update scenario above ,final value is coming from Trigger.

1 Answer 1


A Workflow Field Update triggers a second round of before and after triggers, so if a workflow and trigger both operate on the same field, the trigger will win. As explained in Triggers and Order of Execution:

  1. Executes workflow rules. If there are workflow field updates:

a. Updates the record again.

b. Runs system validations again. Custom validation rules, flows, duplicate rules, processes, and escalation rules aren’t run again.

c. Executes before update triggers and after update triggers, regardless of the record operation (insert or update), one more time (and only one more time)

Note 11(c) is applicable here. Your update triggers will run if a Workflow Field Update results in a modification to a record.

For this reason, it is important that you choose one or the other method of updating records. You should not mix declarative features (Workflow Rules, Flows) with code (triggers) on the same object.

  • ..point is incase of insert Workflow is winning..that is my confusion...in that case trigger is not updating
    – SFDC LWC
    Apr 16, 2022 at 13:10
  • the above thing which u told works very correctly in UPDATE operation...that's y the confusion
    – SFDC LWC
    Apr 16, 2022 at 13:11
  • @SFDCLWC You'd have to check the debug logs. In case of insert, you have an insert trigger > workflow field update > update trigger. In an update, you have an update trigger > workflow field update > update trigger. Also, note that if the record isn't actually modified by the field update, the triggers won't fire again., even if the workflow rule is triggered.
    – sfdcfox
    Apr 16, 2022 at 13:14
  • yes u re right...in the logs ...it is the same order the way you told and its workflow field update action only...if u try u also will get the same result...that's y i have posted it over here....dont know what exactly is the issue?
    – SFDC LWC
    Apr 16, 2022 at 13:17
  • like WF whenever it is created ,it is updating industry to Banking, and Before insert trigger updates it to Finance...the final value upon record insertion is Banking.
    – SFDC LWC
    Apr 16, 2022 at 13:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .