You need to sign in to do that
Don't have an account?

OnClick sforce.connection.query size limit
Hello,
I am writing code for a button to update one field in all Opportunities in our system. The way I do is this:
the problem is that when I get allIDs.size, the size is 2593, however, as soon as the counter hits 2000 I get an error saying that it cant read ID from unidentified, also when I took the allIDs object and analyzed it in notepad++ I saw that it actually contains only 2000 records, but it shows size of 2593.
Later on I found out that there is a 2000 record limit on these queries. What are my alternatives?
Thank you!
I am writing code for a button to update one field in all Opportunities in our system. The way I do is this:
var allIDs = sforce.connection.query("SELECT Id FROM Opportunity"); .... for (i = 0; i<parseInt(allIDs.size); i++){ var opportunityID = allIDs.records[i].Id; ...
the problem is that when I get allIDs.size, the size is 2593, however, as soon as the counter hits 2000 I get an error saying that it cant read ID from unidentified, also when I took the allIDs object and analyzed it in notepad++ I saw that it actually contains only 2000 records, but it shows size of 2593.
Later on I found out that there is a 2000 record limit on these queries. What are my alternatives?
Thank you!
SOQL-select record governer limit is 2000. so you have to user limit or OFFSET concept in your query is its more than 2000.
it will be you use to avoid limit error .
Seems you are using SOAP APIs, where by default the max records returned are 500, which could be uplifted to 2000. Best would be to use "queryMore" to load the records. Here is a post from salesforce docs with good code samples for the same:
you have to use API call for this.
kinldy consider below sample code:
read the linke carfully and try to change your code according to that.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_querymore.htm
Hope this will helps you.
Thanks
karthik