You need to sign in to do that
Don't have an account?
Nitin Sehgal
How to break a List<SObject> into multiple Lists?
Hi Everyone,
I have a problem, that is i have a List<SObject>, which contains more then 10000 records and i want to perform insert operation on that List but it hits the limit.
So, can anybody suggest me how can i break this list into multiple lists.
Thanks in advance.
In that case I'd look to reduce the size of the scope for each batch transaction. The default is 200, so if you are creating > 10k records from those, drop it down to 100. I've had to reduce the batch size to 3 in the past due to the sheer number of post-processing that took place in triggers. It runs slower, but it works.
All Answers
Much depends on how you are constructing the list. One way would be to use batch apex which breaks your processing up into a number of discrete transactions, allowing you to process 10k records per transaction.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm
Hi Bob,
Thanks for you help but i am I am inserting records from batch apex. What i am doing is getting some records and match with some other records and then if records dose not match then i create new records. I have a large no of records in my org. New inserting list have more then 10k records which is causing limit hit.
Please suggest somthing.
Thanks,
Nitin
In that case I'd look to reduce the size of the scope for each batch transaction. The default is 200, so if you are creating > 10k records from those, drop it down to 100. I've had to reduce the batch size to 3 in the past due to the sheer number of post-processing that took place in triggers. It runs slower, but it works.
Thanks Rob.. :) It worked for me but it very taking a long time. Thanks a lot.