How can I change the ParentId field for attachments via Data Loader?
|Knowledge Article Number||000232475|
|Description||I am trying to use the Data Loader to move or merge attachments over to different records however, I do not seem to be able to edit or update the ParentId field for attachments.|
|Resolution||It is not possible to transfer Attachments or update their ParentId to a different record via the API (Data Loader, Workbench, etc.).
You'll find the Properties section of the ParentId field in the Attachment object's API documentation does not include or list the Update call as supported for this field.
You can download the files and then reattach them to desired records manually via the user interface.
Or alternatively, you can export existing attachments and then use the export file to prepare an insert file in order to re-create or insert the attachments on desired records.
1. Export all attachments via Exporting Backup Data by selecting the "Include images, documents, and attachments" option.
2. See Renaming exported Attachments/Documents files in a data export for instructions on reassociating your attachment file names.
3. Using the exported data prepare your insert file in Excel by updating:
ParentId: Update this field with each attachment's new related record Id
Body: Populate this with the file path or location of the attachment's file on your local machine
Id: Re-label this column to "Old Attachment Id"
4. See Uploading Attachments for instructions on inserting the updated attachments.
5. Lastly, if you need to delete the attachments from their original records perform a Delete operation via the Data Loader against the Attachment object and map the "Old Attachment Id" column to the Salesforce Id field.