4. Agenda
• Challenges with Triggers
• Trigger Patterns to the Rescue
• Anatomy of a Trigger Pattern
• Implementing an Advanced Trigger Pattern
• Understanding the Order of Execution
• Q&A
5. Some Housekeeping Rules…
• Mute your mic
• Keep adding questions in Zoom Q&A Window
• No questions are silly!
• Questions will be answered in the last 15 mins of this session
7. Challenges with Triggers
1. Maintenance heavy complex implementations
2. Non deterministic execution sequence for multiple triggers on
same events
3. Recursive execution resulting in Infinite Loops
8. Handler Pattern to the Rescue
Proven design pattern enabling efficient implementation of Apex triggers
to overcome common implementation pitfalls
9. Anatomy of a Handler Pattern
sObject Trigger Handler
Apex Class
Apex Class
Clean Trigger Implementation Controlled Delegation Business Logic & Utility
10. Benefits of Handler Pattern
Enforces One Trigger Per Object rule to drive maintainability
Enables clean code
Promotes code reusability
Drives deterministic execution sequence of triggers
Eradicates occurrence of infinite loops