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
TenaTena 

Right Way? Write ALL code in one Trigger or Many

I have heard recently that it is best to put all the code into one trigger and create classes for each function.  However, I watched a training module and it said to break it out into separate triggers.  What is right?
Sonam_SFDCSonam_SFDC
Hi Tena,

We recommend  users to have one trigger per event per object,
ref: http://wiki.developerforce.com/page/Apex_Code_Best_Practices
Please see Best Practice #5: Streamlining Multiple Triggers on the Same Object at the link mentioned above.

 Force.com platform does not guarantee the execution sequence for multiple triggers with same event on the same object.

Thus, you need to make sure that you have one trigger per event per object.
TenaTena
Great.  I haven't seen this document before.  Thanks so much :)