Skip to main content

zqueryMore Method


zqueryMore Method


This article describes the Order Builder zqueryMore() method. The zqueryMore() method uses the Zuora queryMore() method to retreive next results if zquery() did not return the entire result set.

The zqueryMore() method is available in Zuora 360 version 2.60 or higher.


zApi.QueryResult zqueryMore (String locator)

Input Parameter

The zqueryMore() method takes the following input parameter.

Parameter Type Description
locator String A marker string, returned by a previous zquery() or zqueryMore() call, that points to the start of the remaining results. Example: "4028e69923eaaa2a0124069b5c887849-50"


The zqueryMore() method returns a zApi.QueryResult object that contains the query results in the records field. 

A typical workflow might to check the response of zquery() to see if it's done, and if not, call zqueryMore() in a loop until done is true, indicating that you have retrieved the entire result set.


The zApi.QueryResult has the following properties.

Property Type Description
zoql String Indicates the  ZOQL query.
queryOptions zApi.QueryOptions Provides information about the queryOptions used in the ZOQL query.


The zApi.QueryResult has the following properties.

Property Type Description
done Boolean Indicates whether the query is complete (true) or not (false). You can use this value as a loop condition while iterating through the results of your query.
queryLocator String If done is false, this value can be passed to the zqueryMore() method to retrieve the next series of records.
records List An array of zObjects of the appropriate type (ProductAccountInvoice, etc.), containing the requested data.
size Integer The number of rows retrieved. If size is equal to zero, then no rows were retrieved.


The zApi.QueryOptions has the following properties. All field names are case-sensitive.

Field Type Description



Defines the batch size of the query result.

Range: 1 - 2000 (inclusive). If a value higher than 2000 is submitted, only 2000 results are returned.


Boolean: True or False

Indicates if the query filter results returned consider case-sensitivity. If True, the query results must match the filter and the letter case. If False, the query must match the filter but ignores the letter case.

WSDL: Version 14.0+


Suppose you have three active accounts:

ID Name
1 mybigbusiness
2 MyBigBusiness

Using a SOAP API call, you send the query request:

  select *from Account where name = 'mybigbusiness'

The query result returns the following when the caseSensitive option is:

  • True: Only one account, ID 1
  • False: All three accounts, IDs 1, 2, and 3


Boolean: True or False

If True, Zuora will execute the query on a READ ONLY database. This option improves query performance.

This feature is in Limited Availability. If you want to have access to the feature, submit a request at Zuora Global Support


The zqueryMore() method  uses the following exception classes to catch the exception when an error occurs in the call:

  • zAPIException
  • zForceException
  • zRemoteException

Sample Code

zApi api = new zApi();

//Set ZOQL for query request
zApi.QueryRequest qr = new zApi.QueryRequest();
qr.zoql = 'SELECT Id FROM Account';

//Set query options
zApi.QueryOptions qo = new zApi.QueryOptions();
qo.batchSize = 20;
qo.caseSensitive = false;
qr.queryOptions = qo;

// Call zquery() to get initial results
zApi.QueryResult queryResult = api.zquery(qr);

// If the result set is not complete, call zqueryMore() to get more records
zApi.QueryResult queryMoreResult;
    zApi.QueryMoreRequest qmr = new zApi.QueryMoreRequest();
    qmr.queryLocator = result.queryLocator;
    queryMoreResult = api.zqueryMore(qmr);