Activity Forums Salesforce® Discussions How to I get the Id of the record the file was uploaded under?

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

    Posted by Prachi on November 21, 2019 at 11:40 am

    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?

    Piyush replied 4 years, 5 months ago 2 Members · 1 Reply
  • 1 Reply
  • Piyush

    Member
    November 21, 2019 at 11:55 am

    Hi,

    You can use the following but i am not sure that this is working:-

    SELECT Id, LinkedEntityId, ContentDocumentId, Visibility, IsDeleted, ShareType,
    ContentDocument.Title, ContentDocument.createdDate, ContentDocument.FileType
    FROM ContentDocumentLink 
    WHERE LinkedEntityId = '5000Y000999MQKTQA4'

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos