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

Exporting Records From standard controller set Error



 I created a custom List Button on Accounts ,which i placed it on Accounts View. when i Click that  i call a VF page





<apex:page standardController="Account" contentType="text/csv#Contact.csv" cache="true" recordSetVar="Accounts"  extensions="Accounts_export">
Customer Name,
"Email Id",
"Billing Street",
"Billing State/Province",
"Zip/Postal Code"
<apex:repeat value="{!Accounts}" var="a">  


and MY controller :



public class Accounts_export {


    public Accounts_export(ApexPages.StandardSetController controller) {








I am Facing problem to export 4000 records to CSV or Excel where i can export 2000 records sucessfully


The Error when i give size as 4000 is 


" Object type not accessible. Please check permissions and make sure the object is not in development mode: invalid batch size: 4000 







Any Ideas ! 

Patrick DixonPatrick Dixon

I guess 4000 is more than you're allowed with the standard pagination code.


So why not just use a custom controller with a SOQL query on Accounts?  Something like:-


public with sharing class Accounts_export {


    public Accounts_export() {



    public <list>Accounts getAccounts() {

       return [Select Name, Phone, Business_Email__c, etc from Accounts limit 4000];