We're using the Enterprise web service to access SalesForce. We built our enterprise.jar this way:

java -classpath ./force-wsc-33.0.3.jar;./ST-4.0.8.jar;D:/apps/jdk7u25/lib/tools.jar com.sforce.ws.tools.wsdlc U:\Projects\RemedyForce\prod_enterprise.wsdl enterprise.jar

I see from this post SOSL returning maximum of 500 records that there was a problem with WSC version 23.0. But we're using the newer 33.0 version.

We set up our configuration and Enterprise Connection this way:

// setup Web Service connection
ConnectorConfig config = new ConnectorConfig();

connection = Connector.newConnection(config);

And then we call the service with our SOQL query string.

QueryResult queryResults = connection.query(soqlString);

queryResults.getSize() will often return a number larger than 500, but the actual list inside the object is always limited to 500. Is there a way to either increase that limit or to page through the additional results?


Query results are broken up in to chunks once they reach a certain size, you need to use the queryMore call to fetch the next chunk. typically you end up with a loop like

  qr = sfdc.query(soql)
  while true {
    if qr.Done {
    qr = sfdc.queryMore(qr.queryLocator)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.