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)
  • As triggers are the first thing many ...

Get Mastering Apex Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.