A developer uses a before insert trigger on the Lead object to fetch - ProProfs Discuss
Topics
Products
Follow Us:

A developer uses a before insert trigger on the Lead object to fetch the Territory__c object, where the Territory__c.PostalCode__c matches the Lead.PostalCode. The code fails when the developer uses the Apex Data Loader to insert 10,000 Lead records. The developer has the following code block:01 for(Lead l : Trigger.new){02 if(l.PostalCode != null){03 List TerrList = [select ID FROM Territory__c WHERE PostalCode__c =: l.PostalCod;04 if(terrList.size() >0){05 l.Territory__c = terrList[.ID;06 }07 }08 }Which line of code is causing the code block to fail?



A. 03: A SOQL query is located inside of the for loop code.
B. 01: Trigger.new is not valid in a before insert Trigger.
C. 02: a NullPointer exception is thrown if PostalCode is null.
D. 05: The Lead in a before insert Trigger cannot be updated

This question is part of Exam ng Pabebe Girls
Asked by Catherine halcombe, Last updated: May 19, 2020

+ Answer
Request

1 Answer

John Smith

John Smith

Answered Jan 08, 2017

03: A SOQL query is located inside of the for loop code.
 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.