You need to sign in to do that
Don't have an account?
sandhya santhanagopalan
accounts update trigger
list<Account> lstAccounts = new list<Account>();
for(order__c objorder:trigger.new){
account a = [select id from Account where id=:objorder.Account__c];
lstAccounts .add(a);
}
update lstAccounts;
How many order will be load when developer attempts to load 150 records.
for(order__c objorder:trigger.new){
account a = [select id from Account where id=:objorder.Account__c];
lstAccounts .add(a);
}
update lstAccounts;
How many order will be load when developer attempts to load 150 records.
HI Sandhya,
Trigger run in a Batch mode so Trigger.New always contains 200 records at one time so if more than 200 ex 500 then it runs three time in the batch of 200.
"Triggers execute on batches of 200 records at a time. So if 400 records cause a trigger to fire, the trigger fires twice, once for each 200 records."
So it's never more than 200 records at a time.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_bulk_idioms.htm
Thanks
Lokesh
All Answers
HI Sandhya,
Trigger run in a Batch mode so Trigger.New always contains 200 records at one time so if more than 200 ex 500 then it runs three time in the batch of 200.
"Triggers execute on batches of 200 records at a time. So if 400 records cause a trigger to fire, the trigger fires twice, once for each 200 records."
So it's never more than 200 records at a time.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_bulk_idioms.htm
Thanks
Lokesh
So the trigger loads only once here as thr r only 150 records.
the options for the above were
150
100
1
0
Thanks
That will better if you will use Map for trigger like below
Let us know if this will help you