Question 1
AdvancedPlatform Development (Platform Developer I) · Logic and Process Automation
A developer is designing a trigger framework for a large enterprise org with high data volumes. The goal is to ensure that the logic is scalable, prevents recursion, and adheres to the order of execution. Specifically, they need to handle a scenario where a before update trigger on the Account object updates a related Contact, which in turn triggers an update back to the Account.
Considering Salesforce's order of execution, what is the primary risk in this architecture and the optimal architectural pattern to mitigate it?
Answer and explanation
Correct answer: B
The primary risk here is infinite recursion where the Account update triggers a Contact update, which triggers an Account update, creating a loop until the governor limit is hit. The standard mitigation pattern is to use a static boolean variable in a handler class to track whether the trigger has already run in the current transaction context.
