Salesforce Certified Platform Developer II — Question 189

An Apex trigger creates an Order__c record every time an Opportunity is won by a Sales Rep. Recently the trigger is creating two orders.
What is the optimal method for a developer to troubleshoot this?

Answer options

Correct answer: C

Explanation

The correct answer is C because adding system.debug() statements allows the developer to trace the execution flow and identify where the duplicate Order__c records are being created. Option A, while helpful, does not directly address the code execution itself, and option B may not be relevant if the issue lies in the trigger logic rather than Workflow Rules. Option D checks code coverage but does not provide insights into runtime behavior or logic errors.