Export and Import of Salesforce Files and Notes from one production org to another production org

I have completed a data export of an org we acquired through the following steps:

  1. In Setup, navigate to Data Management | Data Export
    enter image description here
  2. Click on either Export Now or Schedule Export button, whichever button is available
  3. Choose file encoding (recommendation is Unicode UTF – 8)
  4. Check the box to include Salesforce Files and Document Versions
    enter image description here
  5. Uncheck the box to replace carriage returns (i.e. new lines) with spaces
  6. Uncheck Include all data (unless you want to export all data)
  7. Check ContentVersion (this includes Salesforce Files and Enhanced Notes)
  8. Check Note (if you want Classic Notes from “Notes & Attachments” related lists) – checked this just in case the had notes in the classic format
    enter image description here
  9. Click Save button
  10. Wait for the email that states that the Data Export is complete which contains a link to your generated export.
  11. Click the link in the email
  12. Download the zip files(s) that were generated
  13. The zip files(s) contain .csv files for the objects exported
    enter image description here
  14. You’ll notice a ContentVersion folder which contains even more files, one per ContentVersion record exported
    enter image description here
  15. The name of these files are the ContentVersion.ID which correlates to the “Id” column in “ContentVersion.csv” file. Note: ContentVersion object is the common object that includes both Salesforce Files and Enhanced Notes. (i.e. File Type of SNOTE are for Notes)
  16. For each “Id” in “ContentVersion.csv” file is then in the folder “ContentVersion” existing with a file name with the same name as the “Id” column value.

My problem is trying to understand how to import these files into our current org. We had a field on the opportunity record of the acquired org that contains the Account ID of the account in our current org we want to attach the corresponding Files and Notes to. We are using Salesforce Lightning.

I was sent to this link for uploading the Notes but completely stumped at how I map these note to the correct accounts.

Import Notes to the ContentNote object with Data Loader

Any clear direction on how to complete this would be appreciated.

Answer

The key to this is the ContentDocumentLink record that is a junction between the Object (Account in your case) and the ContentDocument (which is the parent of ContentVersion). You have to reconstruct this.

Example:

Source org

ContentDocumentLink.LinkedEntityId = someAccountId in source org
ContentDocumentLink.ContentDocumentId = some ContentDocument parent of 
                                        one or more versions of a ContentVersion

Target org (you have to build this)

ContentDocumentLink.LinkedEntityId = someAccountId in target org
ContentDocumentLink.ContentDocumentId = some ContentDocument parent of 
                                        imported ContentVersion

When I have done this in the past (and it was an unpleasant experience requiring a lot of concentration), I ended up using a spreadsheet tool to do the correlation. Others have used MySQL or MS Access to keep track of the correlation.

Remember that the Ids of the source org will never be the same as the Ids in the target org. If you transferred accounts and opportunities already, you know this by now. You would have had to do an xref prior to Data Loading the Opportunities to make sure that the uploaded Oppos point to the newly uploaded Accounts (and the right Accounts)

Doing the Files and Notes is no different except the schema is more complicated

Attribution
Source : Link , Question Author : Rachel Linder , Answer Author : cropredy

Leave a Comment