6

I know how to query all the attachments related to the opportunity, but how to do the same for files attached. Seems like a file is a part of a content library.

  • Are these chatter files? If so, this related question should provide a solution for you. – battery.cord Jun 3 '16 at 18:50
  • No, I'm asking about Files. You can attach files using Lightning experience – Mike Raven Jun 3 '16 at 21:24
  • Solved. The file is actually a content document and could be easily obtained via foreign key: SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '<Opportunity or other object id here>' – Mike Raven Jun 3 '16 at 23:04
  • 2
    Can you add your comment as an answer and mark it as best answer, as it might help other users in the future with the same question. – Jenny B Jun 4 '16 at 19:49
9

Solved. The file is actually a content document and could be easily obtained via foreign key:

SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '<Opportunity or other object id here>'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.