I have a attachment file which is from a Salesforce Org. Now I need to upload those attachment in different salesforce org. In my attachment file, I can't see the body column, instead I can see ContentType column, so while uploading the file I'm getting error Body is required.

What could be possible reason for body column not present in my attachment file and what should I do to fix this?

  • How did you extract this file? Did you use the Weekly Data Export feature?
    – David Reed
    Mar 3, 2019 at 13:18
  • I think it was done using dataloader.io, but not sure, as someone else did it Mar 3, 2019 at 13:43

1 Answer 1


Export and import behavior with Attachment, and other objects that have binary-blob fields, varies depending on what tool and API you are using.

If you execute a query via the REST API, the response will include for the Body field the URL where you can access the body, but doesn't include the body itself:

GET /services/data/v44.0/query/?q=SELECT+Id,+Body+FROM+Attachment

{ "totalSize" : 1, "done" : true, "records" : 
            "attributes" : { "type" : "Attachment", "url" : "/services/data/v44.0/sobjects/Attachment/00P1R00000gXXXXUAS" }, 
            "Id" : "00P1R00000gXXXXUAS", 
            "Body" : "/services/data/v44.0/sobjects/Attachment/00P1R00000gXXXXUAS/Body" 

When using the SOAP API,

You can access all of the fields using a query() call. However, you can't receive the Body field for multiple records in a single query() call. If your query returns the Body field, your client application must ensure that only one row with one Attachment is returned; otherwise, an error occurs. A more effective approach is to return IDs (but not Attachment records in the Body field) from a query() call and then pass them into retrieve() calls that return the Body field.

The Bulk API does not support extracting binary-blob fields. It has special requirements for constructing a job that inserts binary content.

The Scheduled Data Export feature optionally may export Attachment and Content files. When it does so, you'll receive separate directories containing the binary content (it won't be included in the CSV files). The file names are constructed from the Salesforce Ids of the corresponding Attachment or Content Version.

The specific data loader that you are using may or may not add functionality around these basic API capabilities.

The Salesforce Data Loader does support loading Attachments, populating the Body column in your CSV with a reference to the file location on your hard drive.

When not using Bulk API mode, it will also extract Attachment Body content to a CSV column, but you should be aware that most spreadsheet applications cannot handle more than 32,000 characters in a CSV cell.

dataloader.io does support import and export of Attachments, using somewhat different semantics than the Salesforce Data Loader.

  • Thanks for your answer! Attachments were exported using Data Export and it does not contain body column Mar 4, 2019 at 7:42
  • @salesforceDeveloper No, you won't get the body content inline with Scheduled Data Export, nor should you. As noted above you'll get binary data in separate directories, if and only if when you ran the export you selected to include attachments and content.
    – David Reed
    Mar 5, 2019 at 1:28

You must log in to answer this question.

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