We are all familiar with the strange triangular hammer, which our doctor hits us with in the knee, making our leg kick out involuntarily. The key to reflexes is that they are automatic and programmed deep inside us. So deep, in fact, that at runtime (err, during life), it's a really big deal when our reflexes stop working. Likewise, Salesforce triggers work on a deep system level. Unlike human reflexes, however, we can program Salesforce triggers. Developers get to decide what happens when the reflexes are triggered.
Triggers run in a well-defined but developer chosen context. We select the object, the
Data manipulation language (DML) statement to act on, and even the before and after status of the DML call. DML refers to a set of keywords: insert
, update
, upsert
, delete
, and undelete
. Triggers are, therefore, one of the most powerful tools in an architect's toolbox. Triggers are phenomenally flexible but with that phenomenal power comes the potential...