Resolving the error "Invalid Query Locator" when using the TIBCO Scribe Online Connector For Salesforce

Resolving the error "Invalid Query Locator" when using the TIBCO Scribe Online Connector For Salesforce

book

Article ID: KB0072688

calendar_today

Updated On:

Products Versions
TIBCO Cloud Integration - Connect ( Scribe ) -

Description

Issue: Customers may experience the "Invalid Query Locator" error when querying data from Salesforce while using the TIBCO Scribe Online Connector for Salesforce. 

Error from the TIBCO Cloud Integration - Connect agent logs:
Message: Execute process failed:
Exception Type : Exception
Message : INVALID_QUERY_LOCATOR: invalid query locator
StackTrace :    at Scribe.Adapter.Salesforce.Behavior.HandleException.CatchException(Exception ex, String query)
at Scribe.Adapter.Salesforce.Services.SalesforceService.RetrieveMultiple(String objectName, String query, String queryLocator, Boolean includeDeletedItems)
at Scribe.Adapter.Salesforce.DataAccess.SalesforceDataAccess.<RetrieveDataInternal>d__28.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at Scribe.Process.ProcessStep4AddnewUserRelationshipstoGroups.Execute(Dictionary`2 settings, IEnumerable`1 dataEntityInput)
at Scribe.Core.Processor.ProcessSupport.ExecuteCallProcess(Guid callingProcessId, Guid processId, Dictionary`2 settings, IEnumerable`1 dataEntityInput)

This is a Salesforce error. 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. Also, query locators can be seen as cursors that provide pagination of the data in Salesforce.

Issue/Introduction

This article explains what the error message "Invalid Query Locator" means and provides the steps on how to resolve it.

Resolution

To resolve the error, review the reasons below on why this issue could occur: 

1. A lot of data is being returned for a single query, so reduce the query page size by editing the Salesforce connection in TIBCO Cloud Integration - Connect. 

2. Per the Salesforce article below, each Salesforce user can have up to 10 query cursors open at a time. This is a hard-coded limit that cannot be increased. If 10 query locator cursors are opened when a client application attempts to open a new one, then the oldest cursor is released. If a call is attempted to an expired or released cursor, salesforce.com will return the INVALID_QUERY_LOCATOR error. To avoid this error, ensure that the client code is not holding open more than 10 query locator cursors. If multiple processes are running using the same salesforce.com user, make sure that their combined query locator cursor count remains at 10 or below.

3. Ensure the Salesforce (SF) user used in the TIBCO Cloud Integration - Connect Salesforce connection is not running multiple or simultaneous processes in TIBCO Cloud Integration - Connect, Salesforce, or other applications. As mentioned above, if multiple processes are running using the same user, make sure that their combined query locator cursor count remains at 10 or below. 

4. Re-schedule or stagger the processes to run at different time intervals. 

5. Ensure you have not exceeded the 15-minute inactivity timeout of a query locator. 

6. Create multiple Salesforce users and connections with different users in TIBCO Cloud Integration - Connect if you need to run multiple integrations in parallel.

7. Look into using the native query block instead of the query block, which would provide more flexibility when writing queries to limit the amount of data returned. You could also consider removing any Fetch block that might not be needed in the flow/map design.

**Please review the Salesforce article below for more information about the error and reach out to your Salesforce admin for further troubleshooting.** 

Additional Information

Invalid Query Locator Error
https://help.salesforce.com/s/articleView?id=000323582&type=1

TIBCO Scribe® Online Connector For Salesforce > Query Page Size
https://help.scribesoft.com/scribe/en/sol/conn/sfdc.htm