afawcett / apex-toolingapi

Apex wrapper for the Salesforce Tooling API
BSD 3-Clause "New" or "Revised" License
134 stars 98 forks source link

Retrieving only 2000 custom fields #30

Open desaikarna opened 9 years ago

desaikarna commented 9 years ago

Hi Andrew,

I am using your sample code for retrieving Custom fields and Custom Objects, the issue I am facing is that in our org we have around 3k custom fields,

when I try to do the same with your class ToolingApi I only get 2000 custom fields. Sample code below ToolingAPI toolingAPI = new ToolingAPI(); List customFields = (List) toolingAPI.query('Select Id, DeveloperName, NamespacePrefix, TableEnumOrId From CustomField ').records; System.debug(customFields.size());

Any ideas why I am getting only 2k fields ?

Update: I figured it out , would have to retrieve records using "nextRecordsURL" .

afawcett commented 9 years ago

Ok thanks for letting us know, i'll mark this as an enhancement.

mattandneil commented 6 years ago

SOAP equivalent like so:

QueryResult result = client.query(strQuery);
List<CustomField> customFields = result.records;
while (!result.done) customFields.addAll((result = client.queryMore(result.queryLocator)).records);

(The queryMore method is already there, it just need to be used by the calling code)