As you learned in the last chapter, Apex code can be used in classes or in triggers. A trigger is a block of Apex code that executes in response to a particular type of change in a record’s data.
Triggers are directly linked to the records in an object so that a trigger fires whenever a record is affected—whether that record is accessed by a standard Force Platform page, a Visualforce page, or through the Web Services API. Once you define logic in a trigger, you can be sure that logic is always executed in response to the appropriate type of change in the records for its object.
Voice of the Developer
Triggers can be deactivated, this ...