Chapter 3: Triggers and Managing Trigger Execution

In this chapter, I want to discuss Apex triggers and correctly managing and developing a structured execution framework for using triggers within Apex.

Triggers are where most developers start working in Apex on the Salesforce platform, and I would personally estimate that's where the majority of Apex bugs are found. I think there are a few reasons for this:

  • Triggers demand bulkification, and a small resource leak can easily break a Governor Limit.
  • Triggers often fire off other save processes that themselves may fail or over-consume resources.
  • Triggers can be impacted by administrative changes more than other areas of code (validation, processes, flows, and so on).
  • Where the triggers are the ...

Get Mastering Apex Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.