You need to sign in to do that
Don't have an account?
salesforce1#
How can bypass SOQL statement to fetch more 1000 records in salesforce
Hi
How can bypass SOQL statement to fetch more 1000 records in salesforce
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Hi
How can bypass SOQL statement to fetch more 1000 records in salesforce
As vinit said that the limit has been revised to 50,000. But this limit is for entire transaction. This means you can have for eg. 10 queries returning 5000 records. Or you can have 1 query returning 50000 records. Once you reach 50,000 records you cannot issue any more queries for that transaction.
Although the limit has been enhanced to 50,000 I have received an error several times when the query returns more than 1000 records. In such cases:
You can use a FOR SOQL to overcome this limit.
So if your regular query is as below:
List<Account> accounts = new List<Account>();
accounts = [Select Id, Name from Account];
then instead of the above query you can use:
List<Account> accounts = new List<Account>();
for(Account acc : [Select Id, Name from Account])
{
accounts.add(acc);
}
However do note that this can work upto 50,000 records.
All Answers
The limit of 1000 no longer applies (except in some special circumstances). Could you elaborate on your problem?
this is the interview question one of my friend asking.
can you explain how can you bypass the SOQL statements.
is there any document for that.
The current limit is 50000 records which can be fetched through SOQL,not sure from where you got 1000 records.Please go through the below link for the same:-
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm
As vinit said that the limit has been revised to 50,000. But this limit is for entire transaction. This means you can have for eg. 10 queries returning 5000 records. Or you can have 1 query returning 50000 records. Once you reach 50,000 records you cannot issue any more queries for that transaction.
Although the limit has been enhanced to 50,000 I have received an error several times when the query returns more than 1000 records. In such cases:
You can use a FOR SOQL to overcome this limit.
So if your regular query is as below:
List<Account> accounts = new List<Account>();
accounts = [Select Id, Name from Account];
then instead of the above query you can use:
List<Account> accounts = new List<Account>();
for(Account acc : [Select Id, Name from Account])
{
accounts.add(acc);
}
However do note that this can work upto 50,000 records.
Hi shailesh,
thank you very much for your guidence.