+ Start a Discussion
Todd B.Todd B. 

Coding Best Practice

In going through the triggers I have created, I noticed that I have created multiple trigger for the same objects.  Moving forward, is it better to create any new triggers for an object in an existing trigger, or is it ok to continue creating additional triggers on the same object.
Best Answer chosen by Todd B.
Blake TanonBlake Tanon
It really depends on how many triggers you have per object and what the criteria for them to run is.  I personally like to have one trigger per object, that way I can better control the logical order of operations in them better and cut back on the size of them where I'm not duplicating variables and what not.  

All Answers

Blake TanonBlake Tanon
It really depends on how many triggers you have per object and what the criteria for them to run is.  I personally like to have one trigger per object, that way I can better control the logical order of operations in them better and cut back on the size of them where I'm not duplicating variables and what not.  
This was selected as the best answer
Ramu_SFDCRamu_SFDC
I second Blake Tanon, It is a good practice to have a single trigger per object as far as possible. There could be situation where two different triggers are fired for an update on the object and we would'nt know which trigger wins. Below is the post by salesforce which explains about the best practices on talks about the same

http://wiki.developerforce.com/page/Best_Practice:_Streamline_Multiple_Triggers_on_same_Object
Todd B.Todd B.
Thank you, I appreciate you feedback .