3

I have to export around 25k attachments from salesforce, change parentId and upload back to salesforce. Can this be done using data loader?. I exported data and it gives attachment body as binary encoded text. I am not able to upload it back. When I am uploading back, it is showing error that body field exceeded max field size.

When I checked in salesforce documentation, it is telling to export attachments using Data export under setup(which will give attachment in separate folders as zip) in salesforce and then upload back specifying attachment folder link in body field.

NOTE :- I have written apex code to clone and reparent attachments through a batch. This dataloader approach is a backup mechanism to revert attachments, if code failed.

Is there a way to directly upload attachments exported through data loader back to salesforce?.

  • Hey @Victor, were you able to discover any workaround to surpass the error and insert attachments via dataloader? – Seesh Nov 8 '16 at 17:57
1

ParentId on Attachment is not an updateable field. Only Create (insert)

From the doc:

ParentId    
 Type
   reference
 Properties
  Create, Filter, Group, Sort
Description
  Required. ID of the parent object of the attachment. The following objects are supported as parents of attachments:
 Account
 Asset
 Campaign
 Case
 Contact
 Contract
 Custom objects
 EmailMessage
 EmailTemplate
 Event
 Lead
 Opportunity
 Product2
 Solution
 Task

You would need to insert as new attachments and then run a separate data loader job to delete the old attachments.

  • You are right. I have to insert the attachments by clearing ID field value and populated with new parent ID. My problem is Data loader is not letting me do that. It is showing error as "field exceeded max size". Is there any workaround for this? – Victor Apr 22 '15 at 5:55

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.