PDI practice question 24 of 30

A developer created a trigger on a custom object. This custom object also has some dependent pick lists. According to the order of execution rules, which step happens first?

Full set: 201 questions
Answer options
A: The original record is loaded from the database. Correct answer
B: System validation is run for maximum field lengths.
C: Old values are overwritten with the new record values.
D: JavaScript validation is run in the browser,
Correct Answer:
A. The original record is loaded from the database.
Explanation

According to the Salesforce server-side order of execution for a save operation (specifically an update), the very first step is to load the original record from the database. This action makes the record's pre-modification values available in memory (e.g., for Trigger.old). This step must occur before any validations are run or any new values from the user's request are processed, ensuring a baseline for comparison and logic execution throughout the transaction.

Why Incorrect

B. System validation is run for maximum field lengths. This occurs after the original record is loaded and the new values from the request are loaded into the sObject in memory.
C. Old values are overwritten with the new record values. This happens in memory after the original record is loaded. The database commit, which permanently overwrites the values, occurs much later.
D. JavaScript validation is run in the browser. This is a client-side action that happens before the data is submitted to the server and is not part of the server-side transaction's order of execution.

References

1. Apex Developer Guide, Salesforce Documentation: In the "Triggers and Order of Execution" section, the documented sequence for an update operation begins with:

"1. Loads the original record from the database..."

"2. Loads the new record field values from the request and overwrites the old values."

"3. Executes system validation steps...verifying that all required fields have a non-null value, and runs any user-defined validation rules."

(Reference: Apex Developer Guide, Chapter: "Triggers", Section: "Triggers and Order of Execution")

2. Trailhead by Salesforce: The "Apex Triggers" module reinforces this sequence.

"When a record is saved, the first thing Salesforce does is load the original record. Next, it loads the new values from the user. Only after that does it start running system validation."

(Reference: Trailhead, Module: "Apex Triggers", Unit: "Trigger and Order of Execution")

Scroll to Top