Plat-Dev-201 practice question 5 of 30

A developer is alerted to an issue with a custom Apex trigger that is causing records to be duplicated. What is the most appropriate debugging approach to troubleshoot the issue?

Full set: 204 questions
Answer options
A: Review the Historical Event logs to identify the source of the issue.
B: Add system.debug statements to the code to track the execution flow and identify the issue.
C: Use the Apex Interactive Debugger to step through the code and identify the issue. Correct answer
D: Disable the trigger in production and test to see if the issue still occurs.
Correct Answer:
C. Use the Apex Interactive Debugger to step through the code and identify the issue.
Explanation

The most appropriate and powerful approach for troubleshooting complex logic issues like record duplication in a trigger is using the Apex Interactive Debugger. This tool allows a developer to set breakpoints and step through the code line-by-line in a sandbox. It provides real-time visibility into variable states, the call stack, and heap size, enabling direct identification of the faulty logic causing the duplication, such as incorrect map usage or recursive execution, which can be difficult to trace with static logs alone.

Why Incorrect

Review the Historical Event logs to identify the source of the issue.: Event Monitoring and Setup Audit Trail logs are for tracking user actions and metadata changes, not for debugging Apex code logic execution. Add system.debug statements to the code to track the execution flow and identify the issue.: While useful, this is a less direct method. It requires modifying code and analyzing text logs, which is less efficient than real-time debugging for complex logic flaws. Disable the trigger in production and test to see if the issue still occurs.: This only confirms the trigger is the source of the problem but does not help in debugging the actual code to find the root cause of the issue.

References

Salesforce Apex Developer Guide, "Apex Interactive Debugger", Section: "Debug Your Code with the Apex Interactive Debugger". (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apexdebugginginteractivedebugger.htm)

Salesforce Platform Developer I Certification Guide, "Debugging and Deployment", Objective: "Describe the tools available for debugging and deploying Apex." The guide highlights the capabilities of the Apex Interactive Debugger for in-depth code analysis.

Scroll to Top