Loading

Unable to change the ParentId field for attachments with Data Loader

Publiseringsdato: Oct 13, 2022
Beskrivelse

It is not possible to re-parent or update an attachment's ParentId field via Data Loader to transfer attachments to other object's records. However, workarounds are available in order to move attachments to new or different records.

 

Løsning

As noted in the SOAP API documentation for the Attachment object, the ParentId cannot be updated with Data Loader or other API tools.

To change their association, you will need to re-upload the attachments to recreate them and associate them with the new parent at that time. You can do this individually in the user interface, or you can export existing attachments and use that export to recreate the attachments on desired records.
 
1. Export all attachments via Export Backup Data from Salesforce by selecting the "Include images, documents, and attachments" option.

2. See Rename exported attachments or document files 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 Upload 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 Data Loader against the Attachment object and map the "Old Attachment Id" column to the Salesforce Id field.
 

See Also:

 
Knowledge-artikkelnummer

000387911

 
Laster
Salesforce Help | Article