I am trying to be able to download a file blob attached to a Case. I was first looking on the attachments table for the id of the file and realized it wasn't there and it was in ContentDocument. The problem I have is that I don't see a method to get the blob like attachment (please tell me I am wrong).

My real question is, how does salesforce decide what is on the Attachment object and what goes to the ContentDocument object?

EDIT: To clarify, my confusion is that I had attached a file to a case under the notes/attachments section. When I went to look for it with SOQL it ended up being in the ContentDocument schema and not the Attachments schema like I would think it would go to.


Attachments are being deprecated in favor of using Files.

The ContentDocument object represents a document that has been uploaded to a library in Salesforce CRM Content or Salesforce Files.


There's a preference included in the Spring '16 rollout of the enhanced notes tool which describes the change in behavior.

To help facilitate the change over to Files from Notes & Attachments a new preference, "Files uploaded to the Attachments related list on records are uploaded as Salesforce Files, not as attachments" has been introduced to ensure that Attachments added via the legacy Notes & Attachments related list are now uploaded as Files moving forward. It is recommended that administrators for orgs created prior Spring '16 enable this feature and for more details see the Upload Files to Notes & Attachments List in Salesforce Classic section of the Spring '16 release notes.

One of the community-created migration tools to get binary content out of Attachments or Notes and into Files and Enhanced Notes:


| improve this answer | |

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