Activity Forums Salesforce® Discussions How to implement the pagination in Salesforce Object Query Language (SOQL)?

  • shariq

    September 22, 2018 at 9:47 pm

    In spring 12, Salesforce has come up with ability of SOQL to get records from position “X” instead of position “1” every time to help creating pagination feature.

    Select Id, Name from Lead LIMIT 5 OFFSET 2
    Above query will return 5 Lead records starting from record number 10 (5×2).

  • Parul

    September 23, 2018 at 5:06 am


    Yes you can implement pagination in Visualforce as follows:

    <apex:pageblockSection >
    <apex:outputPanel id=”myPanel”>
    <apex:PageBlockTable var=”c1″ value=”{!cnd}”>
    <apex:column headerValue=”First Name”>
    <apex:inputField value=”{!c1.First_Name__c}”/>
    <apex:column headerValue=”Last Name”>
    <apex:inputField value=”{!c1.Last_Name__c}”/>
    <apex:column headerValue=”City”>
    <apex:inputField value=”{!c1.City__c}”/>
    <apex:facet name=”footer”>Showing Page # {!pageNumber} of {!totalPages}</apex:facet>



Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos