hiexam
salesforce · Certified-Platform-Developer-II · Q605 · multiple_choice · topic_1

What is a potential design issue with the following code? trigger accountTrigger on Account (before update){ Boolean pr…

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> IstAllOpp = [select StageName from Opportunity where accountId IN :Trigger.newMap.keySet()]; if(!IstAllOpp.isEmpty()) processOpportunity = true; while(processOpportunity) { for(opportunity o : IstAllOpp) if(o.StageName == 'Closed - Lost') opptysClosedLost.add(o); processOpportunity = false; if(!opptysClosedLost.isEmpty()) delete opptysClosedLost;
  • A.SOQL could be avoided by creating a formula field for StageName in Account from the related Opportunity
  • B.The code will result in a System.LimitException : Too many script statements error
  • C.The code will result in a System.DmlException:Entity_is_Deleted error
  • D.The code will result in a System.LimitException: Apex CPU time limit exceeded error
Practice with progress tracking

Sign in to track wrong answers, get spaced-repetition reminders, and run timed exam mode.