I am able to fetch for each soql only 2000 records(Due to Governer limitis) for external objects. but i want to fetch the remaining records and pass the remaining list also to vf page to display the records. Please let me know how to overcome this governor limit issue and display all the records in Vf page.

  • This technique is called list of lists. Check the answer of @krishsfdc Jun 9, 2016 at 13:54

2 Answers 2


You can do so by this steps:

  1. Get the count of external object.
  2. Divide this by 2000, use this value in the for loop condition.
  3. In the loop query the object and add the records to a list.
  4. for every iteration add the records to the list.
  5. One more thing to take of is that, put the offset 2000 * n, where n = 1,2,3.. in the query so that the records will not be duplicate.

After this steps you will get all the records to display on the vf page.

Hope this helps you!!

  • Hello,Count() is not supporting for external objects.Any suggestion can helpful here
    – saru
    Jun 20, 2016 at 10:19

If this is a Visualforce page you can use the readOnly attribute to allow the display of upto 1 million records like so:

<apex;page readOnly="true">

As the name suggests, you can only use this to view the records, not perform any action on them.

  • is it for external lightning connect objects? Jun 10, 2016 at 12:55
  • @susanoochidori For display yes
    – user24634
    Jun 10, 2016 at 13:00
  • Yes It is the limitation for external object.
    – saru
    Jun 13, 2016 at 5:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .