function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LinThawLinThaw 

Maximum save records for StandardSetController?

Hi there,

How many records can save using save method of StandardSetController.

I try with 10111 records, but there is no governor error found.

there is debug source...
List<TestObj__c> saveRecordList = new List<TestObj__c>();

String queryStr = 'Select id, Name, TestField__c From TestObj__c limit 10111';

ApexPages.StandardSetController saveRecordListSetCon = null;

saveRecordListSetCon = new ApexPages.StandardSetController(Database.query(queryStr));

saveRecordListSetCon.setPageSize(10111);

saveRecordList = saveRecordListSetCon.getRecords();

for(TestObj__c r : saveRecordList ){
    r.TestField__c = 'test10111';
}

saveRecordListSetCon.save();

Regards,
LinThaw
sravan velamasravan velama
Hi LinThaw,

There is no limit on saving the records.
Please refer to the below link for more information
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/apex_ApexPages_StandardSetController_methods.htm
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Linthaw,

May I suggest you please refer the below link for reference. Hope it helps.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar
LinThawLinThaw
Thanks Kumar and Velama,

I got some useful information from your post.

・No limit on saving the records,
・But need to define limit to avoid
   > Maximum view state size limit (135KB) exceeded error
   > Heap Size (3 MB) exceeded error

Regards,
LinThaw