Salesforce Platform Developer I (legacy) — Question 14
How should a developer prevent a recursive trigger?
Answer options
- A. Use a ג€one trigger per objectג€ pattern.
- B. Use a static Boolean variable.
- C. Use a trigger handler.
- D. Use a private Boolean variable.
Correct answer: B
Explanation
The correct answer is B because using a static Boolean variable allows the developer to control the execution flow of the trigger and prevent it from running recursively. Options A and C may improve trigger organization or functionality, but they do not directly address recursion. Option D, while useful, does not provide the same level of control as a static variable.