1. We should always have one trigger for one object... 2. We should make use of handler class instead of writting code inside trigger.. 3. You can define different methods inhandler class based on event which you can call fro trigger.. 4. Use recurrision handler to avoid the recurssion. 5. DOnt use DML inside forloop.. https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices
1.Always try to have one trigger on one object rather than having multiple triggers. 2.Try to define the dml operations outside the loop (Bulkyfying),so it would not touch the governor limit, that means at maximum Total number of DML statements issued are 150 https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm 3.Most of the times try to avoid recurrsion of the triggers (read about recurssive triggers) 4.if you do have a requirement that leads to recurssion of the triggers then define Static boolean variable within your trigger. Let me know if you need further info about this. mark this as best answer if this solves your problem,so that this may be helpful to someone else.
Following are the best practises for triggers..
1. We should always have one trigger for one object...
2. We should make use of handler class instead of writting code inside trigger..
3. You can define different methods inhandler class based on event which you can call fro trigger..
4. Use recurrision handler to avoid the recurssion.
5. DOnt use DML inside forloop..
https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices
Please refer above link for more details...
Thanks,
Sandeep
2.Try to define the dml operations outside the loop (Bulkyfying),so it would not touch the governor limit, that means at maximum Total number of DML statements issued are 150
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm
3.Most of the times try to avoid recurrsion of the triggers (read about recurssive triggers)
4.if you do have a requirement that leads to recurssion of the triggers then define Static boolean variable within your trigger.
Let me know if you need further info about this.
mark this as best answer if this solves your problem,so that this may be helpful to someone else.