Trigger design patterns
In this section, you will learn how you can call logic from a class into a trigger. Imagine that you need to do complex calculations for opportunities and the related products; you will write these calculations only once and want to reuse this logic in several circumstances (for a Visualforce page, a Lightning component, and a trigger). We will call this logic from a class and execute this logic during the execution of a DML operation (before or after an insert or update of a record).
One best practice of trigger design is to have one trigger for one object and one or more classes, where you call the logic in the different types of DML operations (before or after insert, update, delete or undelete). When implementing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access