I am trying to implement pagination on one of my visualforce pages:

As per the standard documentation:


I have used:

<apex:panelGrid columns="2">
   <apex:commandLink action="{!previous}">Previous</apex:commandlink>
   <apex:commandLink action="{!next}">Next</apex:commandlink>

but it throws an error: "Error: Unknown method 'AccountStandardController.previous()"

Visualforce Code:

<apex:page sidebar="false" showHeader="false" StandardController="Account" extensions="ActProp">
  <apex:form id="details"> 
    <apex:pageBlock title="Properties Operated" helpTitle="Properties Help" helpUrl="https://help.salesforce.com/htviewhelpdoc?id=co_relatedlist.htm&siteLang=en_US">
      <apex:pageBlockTable value="{!props}" var="a">
        <apex:column headerValue="Actions">

          <apex:column headerValue="Properties Name">
          <apex:outputLink value="/{!a.Id}" title="{!a.Name}" target="_top">{!a.Name}</apex:outputLink>
          <apex:column value="{!a.Asset_Type__c}"/> 
          <apex:column value="{!a.RecordType.Name}"/> 
      <apex:pageBlockButtons location="top">
        <apex:commandButton action="{!URLFOR($Action.Property__c .New)}" value="New" />

    <apex:PanelGrid columns="2">
      <apex:commandLink action="{!previous}">Previous</apex:commandlink>
      <apex:commandLink action="{!next}">Next</apex:commandlink>

Apex controller:

public with sharing class ActProp{
   public List<Property__C> props {get;set;}
   public ActProp(ApexPages.StandardController cont) {
   String AccountID = cont.getId();
   props = [Select Name, RecordType.Name, Asset_Type__c, Status__c 
   from Property__c 
   where Operator__c = :accountId 
   and Status__c = 'Active'];

Please assist me on this issue.


1 Answer 1


The page you linked uses recordSetVar to change a normal page to a StandardSetController page. However, that would only let you iterate over accounts, which is not your intent.

To use pagination from a query, you have to implement your own StandardSetController. That looks like this:

public class ActProp {
    public ApexPages.StandardSetController props { get; set; }
    public ActProp(ApexPages.StandardController controller) {
        props = new ApexPages.StandardSetController(
          [Select Name, RecordType.Name, Asset_Type__c, Status__c 
           from Property__c 
           where Operator__c = :controller.getId()
           and Status__c = 'Active'

From there, you can implement pagination:

<apex:panelGrid columns="2">
   <apex:commandLink action="{!props.previous}">Previous</apex:commandlink>
   <apex:commandLink action="{!props.next}">Next</apex:commandlink>

And to view the records, you can iterate over props.records:

<apex:pageBlockTable value="{!props.records}" var="a">
  • Thanks for this response. The pagination works now but throws error with Unknown property 'SObject.Name' and Unknown property 'SObject.Asset_Type__c'. ALthough these exists in Custom object Property (props) Jul 1, 2016 at 16:36
  • @SalesforceDeveloper The returned list is a generic record object ("SObject"). You'll want to use dynamic field access: {!a['Name']}.
    – sfdcfox
    Jul 1, 2016 at 17:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .