Error:
We have the following error message from Salesforce system when we send final answer form SAP.
“SoapFaultCode:4 System.LimitException: Too many DML statements: 151 C
Reason:
it works fine when a single payment is inserted however when i do bulk upload of new payments i get this error
System.LimitException: Too many DML statements: 151
Solution:
Need to update code to handle for the bulk insertion of records.
Do the updation out side the for loop.
Example:-
list<invoice__c> lstInvs = new list<invoice__c>(); declare it below the objSet declaration
then in the for loop
objAcc.CC_Expiry_Date__c = objOpp.Expiry_Date__c;
objAcc.Creditcard_Type__c = objOpp.Credit_card_Type__c;
lstInvs.add(objAcc);
then at last update the list (outside for loops)
update lstInvs;
Comments