function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tan JTan J 

Inserting more than 10K records batch apex

I have parent object A and child object B. I queried object A and  passed query  through getquerylocator in start method of batch apex. I do lot of custom code in execute method and then create a list of new child records for inserting. When I do insert, I receive DML error saying that I cannot insert more than 10k records. I am trying to find solution for this. Here is what I have thought till now. 1) do whatever custom logic outside batch apex and pass list of newly created child records to start method. But how should I do that? Start method only accepts soql query or iterator 2) tried implementing iterable but was not able to do it. Now Need your help to understand how should I solve this problem. To put it in one sentence- I have a list of more than 10k records to insert. How should I do it through batch apex? Thank you!!
zhang yueqizhang yueqi
Dear Tan,
Can you copy your code here? then we'll know how doesn't it work
Thanks
Zero.zhang