I don't quite understand when does a transaction ends. I have one class with 10 functions. Each function does approximately 2000 rows inserts or Updates. I have a total DML statements is about 16 SOQL statements for the whole class. I'm very carefully and always do bulk inserts or updates.
So why do I still get "Too Many DML rows" error? Doesn't the transaction end after each insert or update?
Thanks
Best Answer
The transaction does not end after each insert of update. The Governor Limits count for a so-called execution context. According to the Salesforce documentation this is:
https://help.salesforce.com/apex/HTViewSolution?id=000187163&language=en_US
In other words: An execution context is all the resulting actions (methods calling each other, triggers etc.) of a request.