Trigger Context Variables in Salesforce Apex: Cheat Sheet With Event Table and Real Errors

Trigger.new    Trigger.newMap    Trigger.old    Trigger.oldMap
Trigger.isBefore    Trigger.isAfter
Trigger.isInsert    Trigger.isUpdate    Trigger.isDelete    Trigger.isUndelete
Trigger.operationType    Trigger.size    Trigger.isExecuting

These are the trigger context variables in Apex. They hold the records being saved and tell you which event fired the trigger.

Four of them can be null, depending on the event. We logged all seven events in a Developer Edition org, so you can look up which variable is set where, which records you can edit, and what each wrong pick throws.

This Tutorial Covers: