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
salesforcequestions123salesforcequestions123 

how to get more than 2000 records from a list view

Hi

 

I am trying to display more than 2000 records from a list view using standardsetcontroller but i can only display 2000 how to increase the limit

piyush parmarpiyush parmar
Hi,

If you make it visualforce page ReadOnly then the records size will increase.

Piyush
salesforcequestions123salesforcequestions123
Hi I dint get you how can i make visualforce page read only
salesforcequestions123salesforcequestions123

Hi 

 

I have 5000 records for one list view named all my contacts i want all the 5000 records in my controller so i can send messages to them but i am getting only 2000 records.How can I get all 5000 records

piyush parmarpiyush parmar
Hi,

try <apex:page readOnly= "true"/>

For more details check http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_page.htm

Piyush
salesforcequestions123salesforcequestions123
Hi I have 5000 records in total for a list view but i am getting only 2000 i will post my code here

controller

public with sharing class ssctestcontroller {
public integer pagesize {get;set;}
public integer currentYear {get { return 2012; } set;}
public integer total{get;set;}
public list<contact> campaignss{get;set;}
public ApexPages.StandardSetController setCon {
get {
if(setCon == null) {
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
[SELECT Id, Name FROM contact LIMIT 10000]));
}
if(this.pagesize == null){
this.pagesize = 2000;
}
this.setCon.setPageSize(this.pagesize);

return setCon;
}
set;
}

public void Campaigns(){
campaignss=new list<contact>();
system.debug('.................'+this.setcon.getpagenumber());

setCon.setFilterId(this.setcon.getfilterid()); // when applied changes 'ORDER BY' regardless of DB QUERY in DB Locator.
List<contact> returnedList = new List<contact>();
campaignss = setCon.getRecords();
total=setCon.getRecords().size();
system.debug('.................'+total);
for(contact a: campaignss){

returnedList.add(a);

}
system.debug(',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'+setcon.getCompleteResult());
system.debug(',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'+setCon.getHasNext());
system.debug(',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'+campaignss.size());

}


}


page

<apex:page controller="ssctestcontroller" action="{!campaigns}" readOnly="true">
<apex:pageBlock >
<apex:form id="theForm">
<apex:panelGrid columns="2">
<apex:outputLabel value="View:"/>
<apex:selectList value="{!setcon.filterId}" size="1">
<apex:actionSupport event="onchange" rerender="list1,list" action="{!campaigns}" />
<apex:selectOptions value="{!setcon.listviewoptions}"/>
</apex:selectList>
<table >
<apex:outputpanel id="list1" >
{!total}
</apex:outputpanel>
</table>
</apex:panelGrid>
<apex:pageBlockTable value="{!campaignss}" var="v" id="list">

<apex:column headerValue="name" value="{!v.name}"/>

</apex:pageBlockTable>
<apex:panelGrid columns="2">



</apex:panelGrid>

</apex:form>



</apex:pageBlock>
</apex:page>

i kept readonly also but i am getting only 2000 records but one of my list has 5000 records but it is showing only 2000 of them