0

I have scenario where in I need to extract content documents related to specific object (Tried to this via SOQL like 2 step query) SOQL for Id's of all the content documents in the org. SOQL on content document link where ContentDocumentId IN {{ContentDocument -- Pass all the id's obtained in step 1}} This fails as I have 110072 content documents. How to deal with such large number of records in SOQL? is there a way around?

More explanation

When querying contentDocumentlink it asks for content document id's working query

  • SELECT Id, LinkedEntityId, ContentDocumentId FROM ContentDocumentLink WHERE ContentDocumentId IN {{ContentDocument_Complete_List!A2:A1000}} I want to be able to pass 111072 id's but this errors out.
2
  • What do you mean 'identify'? what do you want to see? where do you want to see it? Please edit your question to clarify exactly what you want to do, and where you're stuck.
    – Nick C
    Commented Sep 19, 2023 at 0:51
  • @NickCook Identify Get SOQL query id's along with their size. Commented Sep 19, 2023 at 1:33

1 Answer 1

0

If you query all ContentDocuments first, you will actually query all files in your org. From what I understood, you only want to know which files are linked to a specific object.

In this case you should query based on LinkedEntityId instead of ContentDocumentId, for example:

SELECT Id, LinkedEntityId, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId IN (SELECT Id FROM Account)

This will give you a list of all the links between your object(or record(s)) and files.

1
  • Thanks @Norvrg.Honestly I was overthinking. I tweaked it to get size from content document, I am still keen to know how to get around issue when we have large number of id's to pass? Commented Sep 19, 2023 at 13:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .