PDI practice question 29 of 30
The Account object in an organization has a master-detail relationship to a child object called Branch. The following automations exist: * Roll-up summary fields * Custom validation rules * Duplicate rules developer created a trigger on the Account object. Which two things should the developer consider while testing the trigger code? Choose 2 answers
Full set: 201 questionsWhen a child record (Branch) in a master-detail relationship is modified, the roll-up summary fields on the parent (Account) are recalculated. This recalculation is treated as an update DML on the parent record, causing the parent object's triggers to execute. This is a critical indirect invocation path to test. Furthermore, a single transaction can cause a trigger to fire more than once. Automations like workflow rule field updates or flows, which run after the initial trigger execution, can update the record again. This subsequent update re-invokes the entire save order for that record, causing the trigger to fire a second time within the same transaction. Developers must design triggers to handle this potential re-entrancy.
B. Duplicate rules are executed once all DML operations commit to the database. This is incorrect. According to the order of execution, duplicate rules run before the record is saved to the database and long before the transaction is committed.
D. The validation rules will cause the trigger to fire again. This is incorrect. Validation rules run after before triggers to check data integrity. They do not perform a DML operation and therefore do not cause a trigger to re-fire. ---
1. Apex Developer Guide, "Triggers and Order of Execution":
This document outlines the precise sequence of events during a save operation. It confirms that workflow rule field updates can re-run before and after triggers (Step 14). It also places the execution of custom validation rules (Step 4) and duplicate rules (Step 5) before the record is saved to the database, and well before the final commit (Step 20). This supports why options C is correct and D and B are incorrect.
2. Salesforce Help, "Roll-Up Summary Field":
This documentation explains, "If your organization has Apex triggers... on the master object, these triggers fire when a roll-up summary field on the master record is updated because of a change on a detail record." This directly supports the correctness of option A.
3. Salesforce Help, "Considerations for Triggers":
This resource states, "Any operation that is executed in a trigger is part of the same transaction... For example, if a trigger causes a workflow rule to fire, the workflow rule is part of the same transaction as the trigger." This reinforces the concept of multiple operations and potential trigger re-firing within a single transaction, supporting option C.
Keep practicing
Take the free PDI practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PDI practice questions
- Question 1What can be used to override the Account's standard Edit button for Lightning Experience?
- Question 4Universal Containers (UC) wants to lower its shipping cost while making the shipping proc…
- Question 5A developer has an integer variable called maxAttempts. The developer needs to ensure tha…
- Question 7Universal Containers wants to back up all of the data and attachments in its Salesforce o…
- Question 8Universal Containers hires a developer to build a custom search page to help users find t…
- Question 9As part of new feature development, a developer is asked to build a responsive applicatio…
