I have completed a data export of an org we acquired through the following steps:
- In Setup, navigate to Data Management | Data Export
- Click on either Export Now or Schedule Export button, whichever button is available
- Choose file encoding (recommendation is Unicode UTF – 8)
- Check the box to include Salesforce Files and Document Versions
- Uncheck the box to replace carriage returns (i.e. new lines) with spaces
- Uncheck Include all data (unless you want to export all data)
- Check ContentVersion (this includes Salesforce Files and Enhanced Notes)
- Check Note (if you want Classic Notes from “Notes & Attachments” related lists) – checked this just in case the had notes in the classic format
- Click Save button
- Wait for the email that states that the Data Export is complete which contains a link to your generated export.
- Click the link in the email
- Download the zip files(s) that were generated
- The zip files(s) contain .csv files for the objects exported
- You’ll notice a ContentVersion folder which contains even more files, one per ContentVersion record exported
- 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)
- 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.
Any clear direction on how to complete this would be appreciated.
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.
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