Study for the Salesforce Platform Developer Exam. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Practice this question and more.


Which trigger event allows a developer to update fields in the Trigger.new list without using an additional DML statement? (Choose 2)

  1. After update.

  2. Before insert.

  3. Before update.

  4. After insert.

The correct answer is: Before insert.

The developer can update fields in the Trigger.new list without using an additional DML statement during the "Before insert" and "Before update" trigger events. When a trigger is set to execute "Before insert," it means that the trigger is invoked before the record is actually saved to the database. At this point, developers have access to the Trigger.new list, which contains the records that are about to be inserted. Therefore, any modifications made to the fields of these records in the Trigger.new list will take effect when the insert operation is performed, without requiring an additional DML operation. Similarly, in the case of "Before update," the trigger is called before existing records are updated in the database. Developers can directly modify fields in the Trigger.new list, and those changes are automatically included in the update operation that follows. This allows for efficient handling of data changes without incurring the overhead of additional database operations. In contrast, for the "After update" and "After insert" events, the records have already been committed to the database. Therefore, modifications to fields in these cases require separate DML statements to affect the records, as any changes made to Trigger.new would not persist in the database.