Use SOQL for loops to operate on records in batches of 200.
SOQL for loop, which iterates over the returned results in batches of 200 records. This reduces the size of the ml list variable which now holds 200 items instead of all items in the query results, and gets recreated for every batch.
for (List<Merchandise__c> ml : [SELECT Id,Name FROM Merchandise__c])
{ // Do something. }
You can also batch apex class to process large number of records
By default triggers will run in a batch of 200 records. For 200 record one trigger invocation, even in case of Bulk API.
Consider a scenario where you're inserting 1100 records then it will be run in 6 batches
200 * 5 + 100 * 1 = 6 (Invocations)
All Answers
if you perform a large operation, the trigger should receive a subset of records (up to 200). I'm not sure whether this can be fixed to be 200.
Hi
Try in this way..It may will help you .
trigger opportunityLimitExample on Account(after delete, after insert, after update) {
List<Opportunity> opptys = [select id, description, name, accountid, closedate, stagename from Opportunity where accountId IN :Trigger.newMap.keySet()];
if(opptys !=NULL && opptys.size() != NULL ){
// write a condition about functionality of Trigger ..to track on how many records are not updated..
for(Integer i =0; i<200; i++){
//write logic
}
//write update or insert statement..
}
}
did this post solve your issue..if so please mark it solved..
thanks
asish
By default triggers will run in a batch of 200 records. For 200 record one trigger invocation, even in case of Bulk API.
Consider a scenario where you're inserting 1100 records then it will be run in 6 batches
200 * 5 + 100 * 1 = 6 (Invocations)
Use SOQL for loops to operate on records in batches of 200.
SOQL for loop, which iterates over the returned results in batches of 200 records. This reduces the size of the ml list variable which now holds 200 items instead of all items in the query results, and gets recreated for every batch.
for (List<Merchandise__c> ml : [SELECT Id,Name FROM Merchandise__c])
{
// Do something.
}
You can also batch apex class to process large number of records