PDII Web TestEngine demo

Exit VCEDump PDII Salesforce Certified Platform Developer II (Plat-Dev-301)
Question 25 of 67
0% complete
Q25 Single choice

What is a potential design issue with the following code?

trigger AccountTrigger on Account (before update) {
Boolean processOpportunity = false;
List<Opportunity> opptysClosedLost = new List<Opportunity>();
List<Opportunity> lstAllOpp = [
SELECT StageName
FROM Opportunity
WHERE AccountId IN :Trigger.newMap.keySet()
];
if (!lstAllOpp.isEmpty()) {
processOpportunity = true;
}

while (processOpportunity) {
for (Opportunity o : lstAllOpp) {
if (o.StageName == 'Closed - Lost') {
opptysClosedLost.add(o);
}
}
processOpportunity = false;

if (!opptysClosedLost.isEmpty()) {
delete opptysClosedLost;
}
}
}

Sign in to mark questions

Sign in to save marked questions and return to this demo.

Sign in