+ Start a Discussion
InternalServerErrorInternalServerError 

Trigger Best Practice

Hi All,

 

I remember reading somewhere that as a best practice one should avoid creating multiple triggers on the same object and instead should have a single trigger invoking a class or classes. What is the reason for this? We currently have about 5 triggers on some objects and this could probably increase, it seems to be more organized to have a different trigger (with a descriptive name) for specific operations. Can anyone advise on this ? 

 

Thanks

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
MikeGillMikeGill

There are a few benefits

 

1. Trouble-shooting / Debugging is alot easier

2. Keeps all the methods called by the trigger in one place

 

I started off creating muitple triggers for the same object, then hit some issues with triggers firing other triggers / recurrsive loops. If I used just a single trigger my life would have been easier.

 

I'm guessing you have seen this one

 

http://blog.jeffdouglas.com/2010/10/21/force-com-programming-best-practices/