Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

QueryLocator

A string returned in QueryResult and used in queryMore() to find and retrieve additional query results. Represents a server-side cursor.

When results for a large or complex query can’t be returned in a single batch, one or more server-side cursors and corresponding query locators are automatically created. A cursor marks the location of additional query results in the database, and a query locator finds the cursor.

A new queryLocator is returned in the QueryResult object when there are more records than can be returned by a query() or queryMore() call. To get the next set of results, follow up with a subsequent queryMore() call using the most recently returned query locator value. Use each queryLocator value only one time.

You can't use queryLocator with queries that access a custom metadata type.

For invalid query locators, the API returns the fault element InvalidQueryLocatorFault and a possible extended error code with additional information.