+ Start a Discussion


Hi guys,

Can anybody explain how to do pagination or share some code on doing pagination in SalesForce.


I will discribe below what I have tried and what my thoughts are on what to try:

I tried to use the query batch size but that gets ignored.

Basically I tried something like the following pseudo code:


pagesize = 50


queryREsult = querySalesForceTroughTheAPI(query,pagesize)   <- here I pass for batch size the pagesize


The problem is that here queryResult.records is 100 let say it ignored the batchsize that I passed.

So my second quess would be that I should cashe the results into a DataTable let say.

So I keep the last queryLocator and when the user moves next I check if I have enough records in the cached DataTable if not I do queryMore and add more records to the DataTable.

But in that case wouldn't the DataTable be able to become too large for large datasets?