15 Jul

The aim of this framework is to establish a consistent structure for Salesforce triggers to achieve the following:  

  1. Control the order of execution of code in triggers so we know what events will take place in sequence 


  1. To provide a more manageable and intuitive design framework so that defect fixing is quicker and logical separation of business rules are ensured 


  1. Improve the efficiency of triggers so that processing is performed faster which is one of the most processor intensive operations 


  1. Able to configure and control individual trigger operations for faster and more controlled processing that leads to a better user experience and fewer defects 


  1. Build monitoring into the fabric of the trigger so that defect fixing has a faster turn around 

There are many well published trigger frameworks and all have merits in that they improve the manageability of code, correctly orders execution, however as with everything, good technologists will continually evolve a model.     We were impressed with Tony Scotts http://developer.force.com/cookbook/recipe/trigger-pattern-for-tidy-streamlined-bulkified-triggers pattern as it simplifies the trigger.   Independently to HarKrishnan https://krishhari.wordpress.com/tag/apex-trigger-design-pattern/ We too noticed some room for improvement because Tony’s framework would require continual adaption of the TriggerFactory class for every new trigger that is developed.   The solution that we came up with was similar to the 2nd framework above.  However, we were concerned that all frameworks to date have only been designed to solve the old-age problem of code manageability and order of execution, but we always incorporated far more into our frameworks, notably the following additional features:  

  • Trigger Control 
  • Code Monitoring 
  • DML Consolidation 

To learn more download the attached document which includes the code and further context of the framework

* The email will not be published on the website.