function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kminevkminev 

Error when trying to query more than 2000 records


I query data which sometimes exceeds 2000 and that happens I receive an error message from the API stating error message = 2000

Is there a limiter that does not allow me to work with more 2000 records and how can I workaround this?


thank you.

Rick.BanisterRick.Banister
The logic to loop through all the records is descrbed in the documentation, but this involves the querymore( )  API call.
kminevkminev
Am I still limited to 2000 records? Even though I use the queryMore method???
SuperfellSuperfell
no, the query can potentially have millions of records, but you work with them in (upto) 2000 row chunks.
Mysti, Developer DocumentationMysti, Developer Documentation

Hi,

A single batch cannot be more than 2,000 records. queryMore works with query to process batches.

See these topics in the API developer guide:

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_calls_querymore.htm

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_header_queryoptions.htm

Mysti Berry
Lead Technical Writer, salesforce.com