Is it possible to run a report on opportunities and attached files? We attach our files via Chatter. I created a report type for Opportunities with Content Documents, but it comes up with no results. Is there a way to get this information somehow?

1 Answer 1


There is no way to report on attachments really at all. You can run reports on chatter files or Salesforce content but you cant see info about the objects they are shared with, just how many times shared, etc. See:


I know I have run SOQl queries in workbench.developerforce.com to identify attachments where parent record is a specific type. It's not a solution for end users but can help in a pinch.

In this case, as you are working with chatter files, you need to run queries against the contentDocumentLink object

You can run the query in developer console or workbench.developerforce.com. If you use workbench, you need to enable 'parent relationship queries' in settings.

Here is a sample query to get you started. It will let you filter against any opportunity fields, but you can only pull in opportunity name and Id to the results list. This is because the linkedEntityID is a 'polymorphic' field that can connect to any type of object, so you cant pull in fields like amount or stage, just name and Id (and perhaps a few other items like createdBy, have not tested)

    Select Id, Linkedentity.name, Linkedentity.id 
FROM contentDocumentLink 
where Linkedentityid IN (SELECT Id FROM Opportunity WHERE Amount < 1000)

You can add filters against opportunity fields in the 'subquery' against opportunity.

Unfortunately you cant use the 'bulk csv' option in workbench with this type of query, as you will get the following error

Failed to process query: FUNCTIONALITY_NOT_ENABLED: Foreign Key Relationships not supported in Bulk Query

You can only use the 'list' option or possibly the 'matrix' option (i have not used matrix before, not sure on that).

You can copy and paste the list to excel, and do what you need there.

  • Hello, yes, if you could do that, that would certainly be helpful! Thanks for your reply.
    – Lily
    Jun 27, 2016 at 7:54
  • added some more info re: the query needed when working w chatter files
    – gorav
    Jun 27, 2016 at 14:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .