AtulRajguru9
AtulRajguru9

Reputation: 254

Salesforce SOQL INVALID_QUERY_LOCATOR exception

When i try to pull many contacts using SOAP API i get NVALID_QUERY_LOCATOR exception. INVALID_QUERY_LOCATOR exception occurre when any query having sub query takes a long time (more than 15 Mins) to execute at SF server and meanwhile SF DB object gets expired.

This exception occurred while executing below query –

Select street, city, country, email, firstname, mobilephone, lastname, postalcode, state, phone, fax, id from lead where Email!=Null and BH4SF__Opted_Out__c = false and id in (select leadid from CampaignMember where campaignId = '70160000000Mk5FAAS') order by Email, CreatedDate

any help on how to resolve this?

Upvotes: 3

Views: 3593

Answers (1)

Levementum
Levementum

Reputation: 11

You are having problems with the governor limits of salesforce. Too many records are being pulled with your query. You can use a list to store the query example:

List<Account> accountsAndCases= [SELECT id, name, (SELECT id, subject, description FROM Cases) FROM Account];

Then work with the list and at the end update your database. Or maybe you can also use the limit call at the end of your query to limit the amount of records you’ll get. Example:

SELECT id, name FROM Account limit 100;

This link might be helpful: https://help.salesforce.com/apex/HTViewSolution?id=000004410&language=en_US

Upvotes: 1

Related Questions