You need to sign in to do that
Don't have an account?

SELECT only returning 20 records
Hey all,
I am having an issue where a SELECT statement is only returning the first 20 records, despite the fact that I have not placed any limits on it. Is there a limit of 20 for what a SELECT can return?
If not, I can post my code to see if anyone can help me with why my query is being limited.
Thanks!
-Derrek
Select statement can return upto 10000 records, if its returning only 20.Probably the user running the code doesn't have access to all records
pls provide more detail
Sure thing,
What I am doing is displaying an editable list of object instances. So logically, I need to query for those objects. That code that follows is the method that gets called in the constructor to find the items. I know there are 39 items that should be returned, but it always gets a max of 20:
This Database.QueryLocator then gets used to build the list:
That debug always reports that the element has a size of 20.
Does anyone know why I am not getting all the records? This occurs across all Model Definitions, which are the containers for these Definitions.
I am also facing the same can anyone look into this?
please
can you check any of three approach:
1: check how many records there for what you are passing in where clause.
2: use either with sharing keywords in controller or go to user profile n check for that object do you have view all permission.
hope this will help you if this is a solution please mark as accepted.
Yes i have checked the three approaches none of them its satisfiying but i'm getting max of 20 records
----page-----
<apex:page standardController="Account" recordSetVar="accounts" extensions="AccountPagination">
<apex:pageBlock title="Viewing Contacts">
<apex:form id="theForm">
<apex:pageBlockSection >
<apex:dataList value="{!accountPagination}" var="acct" type="1">
{!acct.name} </apex:dataList>
</apex:pageBlockSection>
<apex:panelGrid columns="2">
<apex:commandLink action="{!previous}">Previous</apex:commandlink>
<apex:commandLink action="{!next}">Next</apex:commandlink>
</apex:panelGrid>
</apex:form>
</apex:pageBlock>
</apex:page>
---------Controller-------
public class AccountPagination {
// The constructor passes in the standard controller defined
// in the markup below
public AccountPagination(ApexPages.StandardSetController controller) {
}
public ApexPages.StandardSetController contactRecords{
get {
if(contactRecords== null) {
contactRecords= new ApexPages.StandardSetController(
Database.getQueryLocator([SELECT name FROM Account order by name]));
}
return contactRecords;
}
private set;
}
public List<Account> accountPagination{
get
{
accountPagination=contactRecords.getRecords();
return accountPagination;
}
set;
}
}
Now suggest me
Okay i got it i didnt override the previous method and next method
Thank you.