What will be the output ?
Assume we have one Trigger defined on Case Object in Salesforce. Trigger code will look like below.
trigger CaseTrigger on Case (before insert) {
System.debug('What will be the output');
}
Now we are going to insert 598 case Record through below code through execute Anonymous window in the developer console.
List<Case> caseList= new List<Case>();
for(Integer i=0 ; i<598 ;i++){
Case caseObj = new Case( Status = 'Working',Origin = 'Phone');
caseList.add(caseObj);
}
insert caseList;
Now can you help us to find out how many times What will be the output
will print in console log ?
Please don't execute in ORG and write the output here. :P
Founder, CEO @ Implado
7 年Hi Nishant Prajapati Congrats...you have won prize money for your answer. Inbox me your Mobile number...Award money will be credited to the same Mobile Number 2$ Only as question also not that much tuff :)
Technical Lead | 4x Certified Salesforce Developer | APEX | Visualforce | JavaScript | Aura | LWC | Integration
7 年The result will display -: What will be the output What will be the output What will be the output 3 times, Because Triggers execute on batches of 200 records at a time.So, So if 598 records cause a trigger to fire, the trigger fires 3 times, once for each 200 records.