nerdexam
Salesforce

PDI · Question #214

What is the value of the Trigger.old context variable in a before insert trigger?

The correct answer is D. An empty list of sObjects. In a before insert trigger, Trigger.old represents the old versions of records being modified, and since records are being newly inserted, there are no "old" versions, so Trigger.old is an empty list.

Submitted by yousef_jo· Apr 18, 2026Logic and Process Automation

Question

What is the value of the Trigger.old context variable in a before insert trigger?

Options

  • AA list of newly created sObjects without IDs
  • Bnull
  • CUndefined
  • DAn empty list of sObjects

How the community answered

(64 responses)
  • A
    3% (2)
  • B
    6% (4)
  • C
    2% (1)
  • D
    89% (57)

Why each option

In a `before insert` trigger, `Trigger.old` represents the old versions of records being modified, and since records are being newly inserted, there are no "old" versions, so `Trigger.old` is an empty list.

AA list of newly created sObjects without IDs

Trigger.new contains newly created sObjects. Trigger.old is for *old* versions.

Bnull

null is a specific value indicating no object reference. While semantically similar to "nothing," for Trigger.old, it's an empty list, not null.

CUndefined

"Undefined" is not a standard Apex value for collection types in this context. Apex collections will typically be either populated, empty, or explicitly null if uninitialized, but Trigger.old is always initialized as a list.

DAn empty list of sObjectsCorrect

Trigger.old contains a list of the old versions of the sObject records. In a `before insert` trigger, records are being created for the first time, meaning there are no previous versions of these records in the database. Therefore, `Trigger.old` will always be an empty List<sObject> in a `before insert` context.

Concept tested: Trigger context variables (Trigger.old) in before insert

Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_context_variables.htm

Topics

#Apex Triggers#Trigger Context Variables#Trigger.old#Before Insert Trigger

Community Discussion

No community discussion yet for this question.

Full PDI Practice