OrgReady

Salesforce Skills & Readiness

Back to Practice
Apex TriggerDebuggingHard

Interview Challenge

Governor Limit Failure at 200 Records

Debug an Apex trigger that works for small updates but can fail when Salesforce processes records in bulk.

Challenge

Version 1

Inspect the evidence

Artifact / implementation

Review the supplied code, configuration or trace before proposing a fix.

trigger AccountTrigger on Account (after update) {
    for (Account acc : Trigger.new) {
        List<Contact> contacts = [
            SELECT Id, Description
            FROM Contact
            WHERE AccountId = :acc.Id
        ];

        for (Contact con : contacts) {
            con.Description = 'Account updated';
            update con;
        }
    }
}

Response workspace

Identify the issue, explain why it is a problem, and describe the fix. Include both your analysis and corrected solution below.

0 analysis characters

0 solution characters