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
Vinu VargheseVinu Varghese 

Workflow rule with Trigger

I am having difficulty for the following:

I have a workflow rule for inserting a record. I also have a Before Insert and After insert trigger on the same object.

When I insert a record, how many times the trigger fire? I know that the order of execution as Before Insert, Validation , After Insert, .... workflow rule etc.

I think the trigger fire initially 2 times (before and after trigger) then after workflow rule again 2 more times (before and after trigger). total 4 times. Is that right? 
Best Answer chosen by Vinu Varghese
ShirishaShirisha (Salesforce Developers) 
Hi Vinu,

Greetings!

First before triggers executes, then after trigger then workflow rule.

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. Custom validation rules, duplicate rules, and escalation rules are not run again.

You may also check the debug log to know that which runs first.

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri