I/m facing issue with DML 10001, and i just want to pass the list of more than 10,000 records from trigger to batch apex. Please advise, how to implement batch apex for the list of records to be inserted. I'm directly passing the list to batch apex after processing the logic as below.

if(InsertList.size() > 0){
   Database.executeBatch(new InsertRecords(InsertList));

And I just want to pass the records to execute method, as I've nothing to do in the Start(Query) method.

Please Advise.


Just return the list in the start method:

public class InsertBatch implements Database.Batchable<sObject> {
  sObject[] source;
  public InsertBatch(sObject[] records) {
    source = records;
  public sObject[] start(Database.BatchableContext context) {
    return source;
  public void execute(Database.BatchableContext context, sObject[] scope) {
    insert scope;
  public void finish(Database.BatchableContext context) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.