+ Start a Discussion
tanmayeetanmayee 

How to migrate Attachments from one org to another

Hi,

 

I am migrating data from one salesforce org to another. Can any one tell me how do I migrate Attachments?

I used the file exporter to download the attachments from the source org but while uploading attachments to the new org

I got the error "Error Converting value to correct data type"

 

Any help would be highly appreciated.

Rahul_sgRahul_sg
you need to map the file location to the body column.

i.e. in your CSV store the full path of file (location) in a column and map it to the BODY column of Attachment in the target org.
Devendra@SFDCDevendra@SFDC

Hi,

 

  • Create an attachments.csv file (the name of the file is unimportant) with the following column headers:
    • ParentId - ID of the record to which the attachment should be associated 
    • Name - Name of the attachment 
    • ContentType - Format of the extension (e.g. .xls, .pdf, etc) 
    • OwnerID - ID for the owner of the attachment
    • Body - File path to the Attachment on the local machine (C:\documents and settings\schun\desktop\attachments\file.xls)
  • Log in to the Data Loader. 
  • Select the "Insert" command. 
  • In the 'Select Sforce Object' step, select the 'Show all Sforce Objects' checkbox and then select "Attachments". 
  • Choose the attachments.csv file. 
  • In the mapping step, map the following fields:
    • Parent ID 
    • Name 
    • Owner ID 
    • Body - Make sure to map the Body column which you created previously with the file extension. This is how you designate the file and location of the attachments to be inserted. 
  • Click "OK" to proceed with the insert. It may take a few minutes but the attachments should be successfully uploaded to your salesforce org.

Also make sure you are using valid Parent Id / Owner Id, as ParentId would be different in second org. So that attachments would get attached to correct Record. 

 

Hope this helps :)

tanmayeetanmayee

Thanks rahul for the reply. About mapping path of the file to the body column of attachment, I am doing the same only but getting the above mentioned error. 

tanmayeetanmayee

Thanks Devendra for explaning the steps in detail . I executed the steps you had mentioned and files were migrated to the target org but when I tried to open the file it seems that data got corrupted. do you have any idea why  the data got corrupted after migration.

Devendra@SFDCDevendra@SFDC
Hi, Check the Body column is a file path, and that the filename matches the name in the Body column. Also you can make use of absolute path while specifying the path.
UC InnovationUC Innovation
We've recently developed an app called Cloud Explorer for Salesforce which allows you to drag and drop records between Salesforce orgs just like how you would copy files from one folder to another in Windows.  This also includes copying attachments.  If interested, you can get more info here:

http://cloudexplorer.ucinnovation.com/

Data Loader was just taking too much time to do, with having to download the records in CSV, relate the all parent records correctly between source and target orgs that have different record IDs, and then upload again.
Ugochukwu Nwuwa 7Ugochukwu Nwuwa 7
How do I extract docs from a salesforce custom report. I have a custom report amd I want to extract all the docs in each records in that report. Kindly assist.