+ Start a Discussion
Stephanie Boggs 17Stephanie Boggs 17 

Invalid Query Locator Error

Hello, a user clicked the standard related contacts quick link and kept scrolling to see more than the first 50 and then instead of loading, there was the error. One account has 57 contacts and another account has 64 contacts. The error is not happening every time. 

Error is: 
ui.services.connection.api.PartnerConnectionException: INVALID_QUERY_LOCATOR: invalid query locator

I went to Salesforce Support and after I asked some questions (1) What is the contact default batch size? 2) Is the contact default batch value configurable? 3) When referencing the client code, since the client is web-based, does this imply multiple tabs are open or is it storing all data from a single session?) they informed me of the following: "Unfortunately based on the error you receive are only handled by Developer team, and we are not trained on developer part so I would not set any false expectations. I would suggest you to contact your internal developer who will be the best person to answer your questions. I have also provided you some developer forum links where you can post your queries."

I am an Admin and don't know enough about apex to resolve this issue. We don't have an internal developer (it's just me). We don't have any custom code. Any code we have is installed from AppExchange packages.

Any assistance would be helpful. Thank you!
Best Answer chosen by Stephanie Boggs 17
Alain CabonAlain Cabon
Nothing magic but  simple and costs nothing: https://orgdoctor.herokuapp.com/
It is New-Zealand tool from: https://cloudtoolkit.co/

Quick find: Critical Updates, System Overview

And finally, you will be just reassured that there is nothing wrong or critical in your org which is always good to see. 

All Answers

Alain CabonAlain Cabon
Hello,

"a user clicked the standard related contacts quick link" :  can you copy/paste an image of this link and the beginning of this list?

You will have to edit the page probably ( wheel > Edit Page ). 
If it is a standard links, that is a bug of Salesforce logically.

 
Stephanie Boggs 17Stephanie Boggs 17
Both are standard, out-of-the-box pages (not Visualforce).
User-added image
User-added image
Alain CabonAlain Cabon
Ok, you are using contacts to multiple accounts. 

There are two related lists for the contacts.

The video below (vidyard (http://salesforce.vidyard.com/watch/fxqHZf2pER29kXRYvkwio3)) explains how to customize this standard list indeed (you probably already know that).

You can post your checked parameters for your setup of your contacts to multiple accounts and we can try to reproduce it with 60 contacts to see on one account.

SET UP CONTACTS TO MULTIPLE ACCOUNTS
Contact to Multiple Accounts lets sales reps relate a single contact record to multiple accounts so that they can easily track the relationships between people and businesses.
http://salesforce.vidyard.com/watch/fxqHZf2pER29kXRYvkwio3

https://help.salesforce.com/articleView?id=shared_contacts_set_up.htm&type=5
 
Stephanie Boggs 17Stephanie Boggs 17
User-added image
Alain CabonAlain Cabon

1) Did you define External lookup or Indirect Lookup for your object Account  or Contact or External Object ?

https://help.salesforce.com/articleView?id=external_object_define.htm&type=5


2) I have created 100 standard contacts for one standard account. There is no problem for scrolling all the contacts.
Account ac = new Account(name='testacc1');
insert ac;
Account ac2 = new Account(name='testacc2');
insert ac2;
List<Contact> lc = new List<Contact>();
List<AccountContactRelation> lacr = new List<AccountContactRelation>();
for (integer i=1;i <= 100;i++) {
      Contact ct = new Contact(firstname='first'+i,lastname='last'+i); 
      ct.accountid = ac2.id;
      lc.add(ct);
}
insert lc;
for (Contact c : lc) {
    AccountContactRelation acr = new AccountContactRelation(accountid=ac.id,contactid=c.id);
    lacr.add(acr);
}
insert lacr;



User-added image

 
Stephanie Boggs 17Stephanie Boggs 17
1) This is the standard Account/Contact lookup field.
2) I don't have the issue myself and the user only has the issue sparingly. 
Alain CabonAlain Cabon
Ok you can ask the same question on other forums.

https://salesforce.stackexchange.com/

https://success.salesforce.com/

With a developer org there are not enough contacts to reproduce this kind of problem.
You have probably hundreds of thousand of contacts.
Stephanie Boggs 17Stephanie Boggs 17
Would it be thousands of contacts on the entire database or for the single account? One account has 57 contacts and another account has 64 contacts where the issue was reported (again, not happening each time).
Alain CabonAlain Cabon
For the entire database because with 57-64 there is a problem that is not easy reproducible.

sfdcfox (https://salesforce.stackexchange.com/users) can know the problem.

There were known issues like this one: https://success.salesforce.com/issues_view?id=a1p3A000000f34BQAQ

ui.services.connection.api.PartnerConnectionException: MALFORMED_QUERY (not the same problem)

As you can see, we need the steps that can be reproduced in "any" org. 

 I can just create 100 related contacts (perhaps rare in real world scenario) but that works in a developer org.
There is any complication in your case.

What AppExchange packages are you using?   (just out of curiosity)

It is always interesting to see if a very simple case can produce a severe blocking error (that existed and still exists in Lightning) but that is not the case here.
Stephanie Boggs 17Stephanie Boggs 17
AppExchange packages we are using that have a trigger on the Contact are:
  • RollUp Helper
  • Duplicate Checker
  • DiscoverOrg
  • Former Positions
Let me know if you need other package criteria.
Alain CabonAlain Cabon
Ok, in fact, the name of the exception is clearly a standard Salesforce class (that is not from your appexchange package).

ui.services.connection.api.PartnerConnectionException: INVALID_QUERY_LOCATOR

We know what is a query locator and a partner connection and that is the standard process of Salesforce for getting data by scope.
Some users had problems with formula fields but that was not the error INVALID_QUERY_LOCATOR.
The fields created by the RollUp Helper are not formulas.
Your related list here is simple and standard without formula fields or rollup fields (no complication at all).
Sorry, no idea.
Stephanie Boggs 17Stephanie Boggs 17
Thank you so much for your help, Alain! Do you think this is something that Salesforce Support should be able to assist with? I created a case there and they told me to post on here. It seemed to be standard Salesforce functionality to me, as well, but they say they cannot support me.
Alain CabonAlain Cabon
1) This is the standard Account/Contact lookup field.
2) I don't have the issue myself and the user only has the issue sparingly. 

That is the worst case scenario (above all "sparingly"). You always have the workaround to use Classics waiting the next release (Winter 19).
Without a case scenario that generates the error each time, it is very difficult to solve the problem that doesn't occur.

You can just relaunch all the default reports of Salesforce and explain to your users that nothing wrong has been detected by these tools.

Quick find >  Optimizer, Lightning Experience > Check Readiness, Optimize with Features

 
Alain CabonAlain Cabon
Nothing magic but  simple and costs nothing: https://orgdoctor.herokuapp.com/
It is New-Zealand tool from: https://cloudtoolkit.co/

Quick find: Critical Updates, System Overview

And finally, you will be just reassured that there is nothing wrong or critical in your org which is always good to see. 
This was selected as the best answer
Stephanie Boggs 17Stephanie Boggs 17
Thanks again for all your help, Alain!