Common Situations Where the 10001 Error Happens
This error can appear in many places inside Salesforce. Let’s look at the most common scenarios.
Apex Triggers Updating Too Many Records
Apex triggers are one of the biggest reasons behind this error. Imagine you create a trigger on the Account object. Whenever an Account updates, the trigger updates related Contacts. Sounds simple, right? But what if one Account has 15,000 Contacts?
The moment the trigger runs, Salesforce tries to update all 15,000 Contacts in one transaction. Since the limit is only 10,000 DML rows, Salesforce immediately throws the error. This becomes even more dangerous when triggers call other triggers.
For ex:
- Account trigger updates Contacts
- Contact trigger updates Opportunities
- Opportunity trigger updates Accounts again
Now multiple automations start running together, and the number of DML rows increases very quickly. That leads in showing error 1001
Salesforce Flows Causing the 10001 Error
Flows are powerful because they allow admins to automate work without coding. But badly designed flows can create huge performance issues. One common mistake is updating all the records with inside loops.
Suppose a flow loops through 12,000 Contacts and updates each one separately. Salesforce counts every update, and eventually the process crosses the 10,000-row limit.
Scheduled flows are also a common reason behind this issue. Many companies create scheduled flows that run every night and process thousands of records together. If the flow is not optimized properly, the transaction fails.
This is why flow optimization is extremely important in Salesforce.
Data Loader and Migration Problems
The Too Many DML Rows: 10001 error is very common during data migration projects. Imagine a company importing:
- 50,000 Contacts
- 100,000 Leads
- 80,000 Cases
At first, the upload seems normal. But behind the scenes, triggers, flows, and workflows start running automatically for every record.
Suddenly Salesforce is trying to process massive amounts of data in one transaction. In result the import fails with the 10001 error. This often happens during:
- CRM migrations
- Bulk uploads
- Data cleanup
- Integration syncs
Recursive Automation in Salesforce
Recursive automation is another major reason behind this issue. It means a process that keeps triggering itself again and again in a loop. For ex:
- Flow updates Account
- Account trigger updates Contact
- Contact flow updates Account again
- Account trigger runs again
This cycle continues repeatedly until Salesforce hits the governor limit. Even this automation is dangerous because it increases DML rows very fast without developers realizing it.
Understanding the Real Root Cause
Most people think the problem is “too much data.” But actually, the real problem is usually:
- Poor automation design
- Non-bulkified code
- DML operations inside loops
- Recursive triggers
- Inefficient flows
Salesforce can handle huge amounts of data when processes are designed properly. But the main problem arises when developers or admins do not optimize their logic for bulk processing.
DML Inside Loops
One of the most common coding mistakes in Salesforce is placing DML operations inside loops. Here is a bad example:
for(Contact con : contactList){update con;}
This code updates records one by one. If the list contains thousands of records, Salesforce consumes DML limits very quickly. Now look at the optimized version: update contactList;
This updates all records together in a single operation and this concept is called: Bulkification. Now you wonder what exactly a Bulkification in Salesforce is?
Bulkification means designing code and automation to handle many records together instead of one at a time. Salesforce almost never processes records individually in real life.
For ex:
- Data Loader imports records in bulk
- API integrations send records in bulk
- Flows often process multiple records together
- Triggers can receive 200 records at once
If your logic only works for one record, governor limits will eventually break your system. This is why Salesforce developers must always think: “What happens if thousands of records run together?”
Difference Between DML Statements and DML Rows
Many beginners get confused between these two limits DML statement and DML row
Let’s simplify it.
DML Statements: This is the number of DML commands used. Ex:
update contacts;
insert accounts;
delete leads;
And Salesforce allows: 150 DML statements per transaction
DML Rows: This is the number of records affected.
If: update contacts; contains:
- 10 Contacts = 10 DML rows
- 5000 Contacts = 5000 DML rows
- 10,000 DML rows per transaction
Understanding this difference is extremely important for troubleshooting Salesforce governor limit errors.