I had a scenario , wherein I am updating 20k + records using a batch apex for a object called - A. There is a after insert/after update trigger written on the same object, which is used to update some values in another object - B. In this process, its hitting the 10001 DML limit error from the trigger. Batch is working fine and the trigger is also bulkified.

To resolve this issue, I took the logic of trigger out and called it from a scheduled class and queued it after 1st batch apex that I had for object A.That is , once object A is updated using Batch 1, Batch 2 will start processing and will update two. This approach is working fine and only 2 DML are issued for 2 updates here.

Now, my question is, why the 1st approach of batch+ trigger is hitting DML limit, is the trigger getting invoked for each of updated happened using batch seperately? Kindly clarify my doubt. Thanks

  • Because there is something wrong with your code and it is not properly bulkified
    – Eric
    Jul 15, 2015 at 16:55

2 Answers 2


The 10000 DML row limit means your code was trying to update too many rows. This means that for batch size X, the triggers on A were updating too many B records. This has nothing to do with the number of statements you issued (which was less than the governor limit), but has to do with the sheer number of records you were trying to update. Splitting the logic across two transactions fixed the problem. This is most likely a data issue, i.e. you have some A that has a huge number of B records. You might need to clean up your trigger to defer the B updates asynchronously if there are too many Bs to process all at once. This probably also means modifying your batch classes as well.


@sfdcfox - yes..you are correct.Thanks.For any synchoronous update the limit for no of record processed in DML is 10k ..For asynchronous there is no limit for that as per salesforce. So, Batch + Batch wins over Batch + trigger approach.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .