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
shailja ranjan 8shailja ranjan 8 

trigger design patterns

Hello, 

I am learning salesforce and quite new to it. can any one pls help me out in trigger design pattern  and frameworks. I am bit confused in this?
Best Answer chosen by shailja ranjan 8
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi shailja,
Here are some trigger best practices
1)Always there should be only one trigger for each object
2)Avoid SOQL Queries or DML statements inside FOR Loops
3)Execute DML statements using collections instead of individual records per DML statement.
4)Avoid complex logic in triggers.Use trigger Handler.
5)Trigers should be "bulkified" and be able to process up to 200 records for each call.

Please refer below links which might help you in this
https://developer.salesforce.com/page/Apex_Code_Best_Practices
http://amitsalesforce.blogspot.com/2015/06/trigger-best-practices-sample-trigger.html
https://developer.salesforce.com/page/Apex_Design_Patterns
https://developer.salesforce.com/forums/?id=906F0000000DBl8IAG

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards