ContentDocument parentId

I am uploading a file via the Files related list on the Contact detail page.
When I query (SOQL) the database I see the relevant ContentDocument and ContentVersion records.
I would like to get the Contact record Id, with the SOQL query but I can’t fine a ParentId field.

How to I get the Id of the record the file was uploaded under?

Answer

You need the LinkedEntityId on the ContentDocumentLink

Attribution
Source : Link , Question Author : Dedo , Answer Author : Fernando Gavinho

Leave a Comment