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
venkatasubhashkvenkatasubhashk 

Exporting Records From standard controller set Error

Hi,

 

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

 

PAGE:

---------

 

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

 

and MY controller :

-----------------------

 

public class Accounts_export {

 

    public Accounts_export(ApexPages.StandardSetController controller) {

controller.setPageSize(4000);

    }

 

}

 

 

 

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 

 

"system.security.NoAccessException: 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];

    }

 

}