Salesforce Certified Platform Developer II — Question 56
A developer has written an After Update trigger on Account. A workflow rule and field update cause the trigger to repeatedly update the Account records.
How should the developer handle the recursive trigger?
Answer options
- A. Deactivate the trigger and move the logic into a Process or Flow
- B. Deactivate the workflow rule to prevent the field update from executing
- C. Use a static variable to prevent the trigger from executing more than once
- D. Use a global variable to prevent the trigger from executing more than once
Correct answer: C
Explanation
The correct answer is C because using a static variable allows the developer to track whether the trigger has already executed during the current transaction, preventing recursion. Options A and B would remove functionality instead of solving the issue, while option D is incorrect as a global variable does not provide the necessary control for this scenario.