In my Visualforce page, I am trying to retrieve all 884 records from a custom object (GeoPolygon__c). I have written the following SOQL query:
SELECT Id,Name,OwnerId,Owner_Name__c,Owner_Territory_Color__c,Country__c,Population__c,Land_Area__c,Population_Density__c,State__c,State_Code__c,JSON_Geometry__c FROM GeoPolygon__c
When executed in the Developer Console, all 884 records are retrieved. When executed in the Visualforce page, only the first 250 records are retrieved. The query is exactly the same. Here is the full line of code in the Visualforce page:
var geoPolygonQuery = sforce.connection.query("SELECT Id,Name,OwnerId,Owner_Name__c,Owner_Territory_Color__c,Country__c,Population__c,Land_Area__c,Population_Density__c,State__c,State_Code__c,JSON_Geometry__c FROM GeoPolygon__c");
The issue is definitely related to the fact that one of the fields in the query is a long text area field (JSON_Geometry__c). When I remove this field from the query, all 884 records are returned in both Developer Console and in the Visualforce page. When I include this field in the query, only the Developer Console returns all 884 records.
Here are the few similar cases that I was able to track down online:
https://success.salesforce.com/answers?id=90630000000gxRYAAY
https://developer.salesforce.com/forums/?id=906F000000090yKIAQ
SOSL query returns only 250 records even if there are more than 2000+ records present
I tried adding a WHERE clause to the query, as recommended by a few people, but the Visualforce page continues to return only the first 250 records.
How can I retrieve all 884 records? The long text area field must be included in the query. Thank you for any help!