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
Lee VakninLee Vaknin 

INVALID_QUERY_LOCATOR when using nextRecordsUrl 

Hi,
I have an issue while I'm trying to get campaigns members using SOQL.
I get the following error in the middle of the process when using nextRecordsUrl  -
[{"message":"invalid query locator","errorCode":"INVALID_QUERY_LOCATOR"}]

please advice. Thanks!
VinayVinay (Salesforce Developers) 
Hi Lee,

Few this which needs to be cause for exception.

>> Too much data for a single query. Try to limit the data.
>> You've exceeded your allowance of having max 5 query locators open.
>> Exceeded 10-minute inactivity timeout of a queryLocator.

Review below link for 'INVALID_QUERY_LOCATOR' error

https://help.salesforce.com/articleView?id=000323582&language=en_US&type=1&mode=1

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
Lee VakninLee Vaknin
Hi Vinay Kumar,
Thank you for your answer. 
Regarding your first advice (limit the data) -
What is the best way to limit the data? And what should be the limit?

Thanks again.
VinayVinay (Salesforce Developers) 
HI Lee,

Data limit in a single query mean to say you can add few filter conditions like WHERE/LIKE etc to reduce the record count when you run a query.

Thanks,
Vinay Kumar
WEN JIEWEN JIE
Hi Lee,

You could add more filter conditions in your SOQL where logic.

Thanks.