Activity Forums Salesforce® Discussions How can I use 'query more' using javascript remoting?

  • Surbhi

    Member
    June 8, 2016 at 2:01 pm

    Hi Ravi,

    Please have a look on below code:

    @RemoteAction

    public static SObject[] getRecords(Id offsetId) {
    if(offsetId == null) {
    return [SELECT Id, Name FROM Contact ORDER BY Id ASC LIMIT 100];
    } else {
    return [SELECT Id, Name FROM Contact WHERE ID > :offsetId ORDER BY Id ASC LIMIT 100];
    }
    }

    function handleResult(result, event) {
    // handle a batch here
    // do more
    if(result.length===100)
    {!$RemoteAction.controller.getRecords}(result[99].Id,handleResult);
    }
    }
    {!$RemoteAction.controller.getRecords}(null,handleResult);

    Thanks

Log In to reply.

Popular Salesforce Blogs

Steps to Connect Pardot to Salesforce

Steps to Connect Pardot to Salesforce

Blog in

Steps to Integrate Salesforce and Pardot: There are some steps to install Pardot in salesforce 1- Click on this link https://login.salesforce.com/?ec=302&startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t1W000000U7P8(production) https://test.salesforce.com/?ec=302&startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t1W000000U7P8 (sandbox) 2- After…

Popular Salesforce Videos