You need to sign in to do that
Don't have an account?
James George 00700
Database.Insert and Limit Exception
Hi Friends,
I was trying a test code to insert 50,000 records using the below code, its throwing the limit exception related to dml rows of 10000 reached.
My question is since I specified false as below
Database.SaveResult[] srList = Database.insert(lstContacts, false);
is this code suppose to insert at least 10000 records, but did'nt do it.
Let me know your comments.
My code below
Thanks
JG
I was trying a test code to insert 50,000 records using the below code, its throwing the limit exception related to dml rows of 10000 reached.
My question is since I specified false as below
Database.SaveResult[] srList = Database.insert(lstContacts, false);
is this code suppose to insert at least 10000 records, but did'nt do it.
Let me know your comments.
My code below
List<Contact> lstContacts = new List<Contact>(); for(Integer x = 0; x<50000; x++ ){ Contact con = new Contact(LastName= 'Keller'+x, FirstName='Helen'+x); lstContacts.add(con); } Database.SaveResult[] srList = Database.insert(lstContacts, false); for (Database.SaveResult sr : srList) { if (sr.isSuccess()) { // Operation was successful, so get the ID of the record that was processed System.debug('Successfully inserted account. Account ID: ' + sr.getId()); } else { // Operation failed, so get all errors for(Database.Error err : sr.getErrors()) { System.debug('The following error has occurred.'); System.debug(err.getStatusCode() + ': ' + err.getMessage()); System.debug('Account fields that affected this error: ' + err.getFields()); } } }
Thanks
JG
Salesforce fixed the limit to process only 10000 records in one transaction by dml. Only you can insert 10000 records.
for(Integer x = 0; x<10000; x++ ){
Contact con = new Contact(LastName= 'Keller'+x, FirstName='Helen'+x);
lstContacts.add(con);
}
For more apex governer limit please see at below link.
https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm
Please select as a best answer if it is work for you. So it help others.
Thanks,
Annu Choudhary
All Answers
visit for more info -- https://www.imagesgoodnight.com/
Salesforce fixed the limit to process only 10000 records in one transaction by dml. Only you can insert 10000 records.
for(Integer x = 0; x<10000; x++ ){
Contact con = new Contact(LastName= 'Keller'+x, FirstName='Helen'+x);
lstContacts.add(con);
}
For more apex governer limit please see at below link.
https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_apexgov.htm
Please select as a best answer if it is work for you. So it help others.
Thanks,
Annu Choudhary
Thanks for your reply and the link.
So the assumption is even with parameter of false, we still cannot catch the limit exception, is that true?