[SalesForce] File SOQL query

I need to search for Partner Accounts that don't have a Partner Agreement attached in the Files section. To find that, I believe the best way is to get a list of all Files attached to the Accounts that match the criteria. I managed to get a list of Files ID, but that is a bit useless for my purpose, what I really need is to include the Title in the results. Is this possible?

Here is my query so far, but I get an error saying

INVALID_FIELD: SELECT ContentDocumentID, ContentDocumentLinks.Title
FROM ^ ERROR at Row:1:Column:27 Didn't understand relationship
'ContentDocumentLinks' in field path.

SELECT ContentDocumentID, ContentDocumentLinks.Title 
FROM   ContentDocumentLink 
WHERE  LinkedEntityId IN
  (SELECT ID FROM Account 
  WHERE   Type = 'Active Partner (signed contract)' 
  OR      Type = '2-Tier Partner')

Any help would be much appreciated.

Best Answer

There is not Title on ContentDocumentLink, availible fields are documented here

You could instead query the LinkedEntity.Name or the ContentDocument.Title if that hepls:

SELECT ContentDocumentID, LinkedEntity.Name, ContentDocument.Title
FROM   ContentDocumentLink 
WHERE  LinkedEntityId IN
  (SELECT ID FROM Account 
  WHERE   Type = 'Active Partner (signed contract)' 
  OR      Type = '2-Tier Partner')
Related Topic