+ Start a Discussion
Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior 

Trigger Frameworks: Are they the best available approach?

Hello folks,

I have a need to improve the way I develop triggers - currently I am using more than one trigger per object with all logic within it. I am aware that it is, probably, the worst way to do it.  I have been analysing all the techniques and during my searches, I have come across with the following article: https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices

It would be important and tremendously welcomed, have your opinion to decide which approach I should adopt.
Best Answer chosen by Zuinglio Lopes Ribeiro Júnior
PratikPratik (Salesforce Developers) 
Hi Zuinglio,

It's always suggested to adopt the Best Practices while writing code. The link you mentioned talks about the best practices while writing trigger. 

Trigger has Context variables to identify the events on which it's getting executed. So rather than writing many triggers on a single object, write a single trigger and call the actions by writing the logic inside an apex class. This also helps in managing the triggers efficiently.

Thanks,
Pratik