0

I am trying to access ContentVersion, ContentDocument, ContentDocumentLink to achieve a count of each contentversion per object. The relationships between the objects

I activated QueryAll Document, and this gets me the count per ContendDocument for each objects :

SELECT COUNT(Id) counter, LinkedEntity.type
FROM ContentDocumentLink
GROUP BY LinkedEntity.type

But now given that I want to know the count of Id for each ContentVersion I am lost on how to query, given that a subquery should be like this for example :

SELECT Id, Title,
    (SELECT Id FROM ContentVersions),
    (SELECT Id, LinkedEntity.Type FROM ContentDocumentLinks)
FROM ContentDocument

which get me all the information, I have the contentVersions and the Object linked to it, but I cannot group to have a count.

Could a SOQL master help me here?

Thanks

2
  • Are you open to or have tried using Apex for the count part?
    – aryashah2k
    Commented Jan 17 at 17:39
  • Hi Art, Are you exploring the data? Or is there some other process that will consume the data? As aryashah2k suggests, there's a lot of object oriented stuff you can do with Apex when you consume SOQL results with related objects. Maybe you could describe where you're headed. Commented Jan 18 at 12:57

0

You must log in to answer this question.