+ Start a Discussion
MiddhaMiddha 

Trigger not accepting 200 records

Hi,

 

I created an "after insert" trigger on Account, which is not getting the complete record set when i bulk insert the records. 

 

I tried to insert 1000 Acocunts using data loader with batch size of 200 and placed a single statement in my trigger (just for test) i.e. System.debug(Trigger.new.size()). All my 1000 accounts are created, but when i see the logs , trigger has been executed for 5 times but everytime it recieved only 100 records i.e. total of 500 records.

 

Can anyone explain why is it missing records.

 

Thanks,

Gulshan

Best Answer chosen by Admin (Salesforce Developers) 
garybgaryb

GreatG - sounds similar to something we experienced. I posted about this and contacted support - you can see the thread here.

Message Edited by garyb on 02-05-2009 04:05 AM

All Answers

NaishadhNaishadh

Yes you are right. Trigger will consider only first record.

 

Use following way. It will work.

 

List<Account> accList = new List<Account>();

 

for(Account a : Trigger.new) {

        accList.add(a);

        //add your logic

}

 

 

garybgaryb

GreatG - sounds similar to something we experienced. I posted about this and contacted support - you can see the thread here.

Message Edited by garyb on 02-05-2009 04:05 AM
This was selected as the best answer