nerdexam
Salesforce

PDI · Question #192

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?

The correct answer is D. Add system.debug statements to the code to track the execution flow and identify the issue. The most appropriate debugging approach for a production Apex trigger causing record duplication is to add System.debug statements to track the trigger's execution flow and identify the point of error.

Submitted by dimitri_ru· Apr 18, 2026Testing, Debugging, and Deployment

Question

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?

Options

  • ADisable the trigger m production and test to see If the issue still occurs.
  • BUse the Apex Interactive Debugger to step through the code and Identify the issue.
  • CReview the Historical Event logs to Identify the source of the issue.
  • DAdd system.debug statements to the code to track the execution flow and identify the issue.

How the community answered

(44 responses)
  • A
    7% (3)
  • B
    2% (1)
  • C
    11% (5)
  • D
    80% (35)

Why each option

The most appropriate debugging approach for a production Apex trigger causing record duplication is to add `System.debug` statements to track the trigger's execution flow and identify the point of error.

ADisable the trigger m production and test to see If the issue still occurs.

Disabling a trigger in production to troubleshoot is risky as it might lead to data inconsistencies or break other dependent processes, and it doesn't provide insight into *why* the duplication is happening.

BUse the Apex Interactive Debugger to step through the code and Identify the issue.

The Apex Interactive Debugger is primarily for debugging in sandbox environments with setup configurations and isn't typically used directly on production issues or for an issue like duplication that might be intermittent or require examining transaction logs.

CReview the Historical Event logs to Identify the source of the issue.

Historical Event logs provide high-level information about events but do not typically offer the granular code execution details needed to debug a specific Apex trigger's internal logic causing data duplication.

DAdd system.debug statements to the code to track the execution flow and identify the issue.Correct

Adding `System.debug` statements is a common and highly effective debugging technique in Salesforce, particularly for production issues, allowing developers to log variable values, execution paths, and intermediate results into the debug log, helping to pinpoint exactly where and why the duplication is occurring without interrupting production service.

Concept tested: Apex debugging best practices

Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_debugging_system_debug.htm

Topics

#Apex Debugging#Apex Triggers#system.debug#Troubleshooting

Community Discussion

No community discussion yet for this question.

Full PDI Practice