You need to sign in to do that
Don't have an account?
SfDevForce
System.Exception: Too many DML rows
I have an account with 8000+ contacts. When the account is updated, a trigger fired and call a class method to update these 8000+ contacts. I'm running into the 'Too many DML rows' problem. Is it possible to do something like this with apex trigger? Thank you.
the max amount of records that can be updated from a trigger is 100.
Page 152.
Message Edited by TehNrd on 10-10-2007 05:09 PM
How come I get an error message :
execution of AfterUpdate caused by: System.Exception: Too many DML statements: 21
Does the "21" mean the number of DML statements? I get this when trying to set ServiceDate of a number of opportunity Line items to match the CloseDate of the parent opportunity. What is really confusing me is that there are only 18 line items on the opportunity which fails, but no eror occurs on another opportunity with 20 line items.
I've had a similar problem with errors saying "too many SOQL statements: 21" using other methods for updating.
Any ideas anyone?
Roger
Here's the full code:
Code:
Message Edited by WrogWrog on 11-28-2007 11:46 PM
Try this:
Code:
Hi Roger,
Just wondering if you have looked into moving out product and revenue schedule dates when the close date changes? (ex. If the user moves the close date out 30 days, all the corresponding product and schedule dates get moved out by 30 days).
My company relies heavily on revenue schedules and the existing disconnnect between close dates and schedule dates is a major issue. Unfortuneately, I'm having a lot of trouble figuring out how to do this with Apex.
Thanks in advance for any help or advice you can offer.
Aiden
My Problem is this for-loop:
I'm getting about 10 line per loop, so I getting also this Errormessage:
Too many DML statements: 21: Class.billingclass.addRechnung: line 42, column 25
Do someone have any sollutions?
But I still have Limitations:
Number of SOQL queries: 19 out of 20 ******* CLOSE TO LIMIT
Number of query rows: 111 out of 1000
Number of SOSL queries: 0 out of 0
Number of DML statements: 8 out of 20
Number of DML rows: 76 out of 100 ******* CLOSE TO LIMIT
Hi
I have the same issue. I get the following error message
Error:Apex trigger syncOpportunitySalesGoal caused an unexpected exception, contact your administrator: syncOpportunitySalesGoal: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0S70000001bFHAEA2; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, syncParentOpportunitySales: execution of AfterUpdate caused by: System.Exception: Too many DML rows: 138 Class.WorkflowTickler.TickleOpportunitySalesGoal: line 17, column 5 Trigger.syncParentOpportunitySales: line 6, column 3: Class.WorkflowTickler.TickleOpportunitySalesGoal: line 17, column 5
Does that mean 138 rows are getting updated . This code has been in production for a long time ad working fine too. But when a user was updating an oportunity is when this error came up
This is the code
for(Opportunity_Sales_Goal__c opportunitySalesGoal:opportunitySalesGoalArr) {
opportunitySalesGoal.Last_Sync_To_Parent__c = currentTime;
}
update opportunitySalesGoalArr;
}
If I comment the update statement the error does not occur. How do I get rid of this error.
Thanks
for(List<Opportunity_Sales_Goal__c> opportunitySalesGoal:OpportunitySalesGoalArr) {
opportunitySalesGoal.Last_Sync_To_Parent__c = currentTime;
}
update opportunitySalesGoalArr;
}
Hi Volker
Thanks for the reply. When I change it to List as you suggested I get, the following error
Save error: Initial term of field expression must be a concrete SObject: LIST:SOBJECT:Opportunity_Sales_Goal__c
The opportunitySalesGoalArr is an array.
This is how the whole method looks
public static void TickleOpportunitySalesGoal(Opportunity_Sales_Goal__c[] opportunitySalesGoalArr) {
DateTime currentTime = System.Now();
for(List<Opportunity_Sales_Goal__c> opportunitySalesGoal:opportunitySalesGoalArr) {
opportunitySalesGoal.Last_Sync_To_Parent__c = currentTime;
}
update opportunitySalesGoalArr;
}
}
Thanks