What is a query locator in Salesforce?

What is a query locator in Salesforce?

A query locator represents a server-side cursor for a query. Typically a query locator is returned when not all the records requested in a query fit into the returned data set. This way a queryMore() can be issued with the provided query locator to get additional rows.

For example, consider a query API call where the batch size is set to 2,000 and the organization has 2000+ accounts. In this scenario, SELECT Id FROM account will return 2,000 records and a query locator to retrieve the remaining records. Using queryMore() method, we have to pass the query locator to retrieve the rest of the records.

Leave a Reply