[SalesForce] Querying more than 15000 records into a VF page using RemoteAction

I have a page that uses AngularJS for front-end rendering and filtering. To make use of the dynamic filtering capability of AngularJS filters, I am loading all the records onto the HTML page, so the client has all the data and filtering is super fast. There are no viewstate problems since this page is totally Angular.

This works fine when up to 14000 records are returned to the UI. But once we hit 15,000 records, I get an error 'Visualforce Remoting Exception: Remoting response size exceeded maximum of 15 MB. '
I used {buffer:false} on the request on this page.

I cannot really use StandardSetController(10,000 records limit) or SOQL Offset (2000 records limit).

Is there any other way I can get the records onto the UI without hitting limits?

Best Answer

Its not ideal/recommended to load all data and send it to browser but I know you will have your valid business requirement.

So here is how i would have achieved it.

Split your request into multiple requests. So basically you fetch first 10k records and then next 10k and so on till you get all records.

Once you get all the records in batches of 10 K merge the all JSON responses and crate one JSON of all records then proceed further with your data table.

Related Topic