function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sahana ShahulSahana Shahul 

Does SOQL query with WHERE and IN Clause has a limitation while comparing huge number of record IDs?

Hi,

I have tried to show list of related Case files(Content Documents) in a lightning component on Account page. While querying I got 12000 related case records for a account. Now I have to fetch the Content Document IDs through Content Document Link. When i run the below SOQL I am getting only few Content Document Link records but I have 11 case records which are having files. The below query results only 5. Is there a limitation on WHERE clause or ContentDocument Link while querying huge number of records?

CaseList=SELECT id FROM Case WHERE AccountId=:accID // This results 12000 case records
List<ID> caseIDs=new List<Id>();
For(Case c:CaseList)
{
                 caseIDs.add(c.Id);

}
SELECT LinkedEntityId,LinkedEntity.Name, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId=:caseIDs // This results only 5 records but we have 11 ContentDocuments

Thanks in advance.
Prakhar Saxena 19Prakhar Saxena 19
Hi Sahana,

I guess there are 5 records (ContentDocumentLinks) which are added on Cases whose AccountId is the one you are passing in the first query. 

Can you just verify whether the other ContentDocuments which are not appearing (6 out of 11) are added on Cases and those Cases' Account Id is the same as the one you are passing?