+ Start a Discussion

SOQL reteiving 250 records only.

Hi all,


I am reteiving list of contact using SOQL query. I want to fetch all the contacts of a particular record type. This query is always returning 250 records. Though there are existing thousands of record.


Please help me


With regards

Palak Agarwal


Do u have a limit on SOQL for it be only 250


Limit 250 



Please check or else post your query we can see further


Hi steve, thanks for your reply,I tried following snippet in debug log. 



list<id> ids = new list<id>();
//List<contact> con = [select id,name,recordtypeid,Candidate_Summary__c,Candidate_Write_Up__c,General_Competency__c,IT_Competency__c,Skill_set__c,Other_Competency__c from contact where recordtypeid = '0120000000096owAAA' ];
for(contact con1 : [select id,name,recordtypeid,JCandidate_Summary__c,Candidate_Write_Up__c,General_Competency__c,IT_Competency__c,Skill_set__c,Other_Competency__c from contact where recordtypeid = '0120000000096owAAA' limit 2000])
system.debug('testing by ks'+ids.size());



NOTE :  All the fields except id,name are long text area fields.


1). If I will exclude all long text area fields, query is returning all the records around 50000.

2).If query is executed before for statement, as shown(Comented query) it returns only 250 records.

3).If query is executed with for statement, then it works for 2000 records only not more than that. After 2000 records, it starts throwing error "Response to EXEC to /_ui/common/apex/debug/ApexCSIAPI was : -1, transaction aborted".


I don't understand why query is behaving in four three different ways.


Please help me, 

With Regards