Which apex trigger framework I should use ? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Mohamed IbrahimMohamed Ibrahim 

Which apex trigger framework I should use ?

Best Answer chosen by Mohamed Ibrahim
Moustafa IshakMoustafa Ishak
Hi Mohamed,

could you please check this link https://www.brcline.com/blog/choose-apex-trigger-framework

if this what you are looking for, please makrked as solved so it can help the community for future reference 😃

thanks 
Moustafa Ishak

All Answers

sakshi nagpalsakshi nagpal
Hi Mohammed,

 Check this out-:
https://www.biswajeetsamal.com/blog/salesforce-apex-trigger-framework/


 Thanks,
Sakshi
Amnon KruviAmnon Kruvi
While it looks great, I don't think the above trigger framework can be implemented as-is. Mainly, we can't create list custom settings anymore, so you'd have to use custom metadata types instead. This article is from 2019, and list-type custom settings have been disabled for quite some time, so I'm not sure what the author intended.

Mohamed, there are many frameworks with different benefits. The real question is: what does your project need?

Are you expecting many small DMLs? Then you need something optimised for speed.
Are you expecting frequent additions, or are building this as part of a managed package? Then you may want something that loads code modules from a registry.
Is speed a concern? Then you need something which is very simple to develop for.

I'm using a very simple abstract class model, which has abstract methods for all the trigger contexts (afterInsert, afterUpdate, etc). The constructor in the abstract class identifies the trigger context and calls the appropriate method. To implement a handler, I create a class that overrides the abstract one, and methods that override the methods I want to work with (afterInsert, afterUpdate, whichever). This results in very simple handler classes that are simple to build, and the trigger itself has just one line of code. However, I didn't put a toggle switch in the trigger framework itself so I don't have to register triggers in the database.

In the end, there is no "best" framework to use.
Moustafa IshakMoustafa Ishak
Hi Mohamed,

there is different frameworks where you can use with Salesforce triggers.

i would suggest to start by having a look on trigger factory framework.

https://developer.salesforce.com/forums/?id=906F0000000kFHnIAM


kindly let me know if you need further information 😃

Thanks 
Moustafa Ishak 
Moustafa IshakMoustafa Ishak
Hi Mohamed,

could you please check this link https://www.brcline.com/blog/choose-apex-trigger-framework

if this what you are looking for, please makrked as solved so it can help the community for future reference 😃

thanks 
Moustafa Ishak
This was selected as the best answer
Mohamed IbrahimMohamed Ibrahim
Hey all,
I would like first thank you all for your time and your help, it is really appreciated. 
​​​​​​
Thanks Moustafa for your last link, it has really a lot of details which will help me to select and build my trigger framework.