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

Salesforce Marketing Cloud Integration with Google Analytics 360

Redefining the future of Marketing – Salesforce Marketing Cloud Integration with Google Analytics 360

Blog in

Know your customers better and make smarter, insight-based marketing decisions through Salesforce’s massive customer relationship management platform twinned with Google Analytics 360’s market-leading digital analytics solution…

Popular Salesforce Videos