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;
}
}
}