Regardless the reason, whether to migrate to another object or to simply backup the data, at first blush this was not a trivial task using typical data export means like Data Loader or Reports.
ContentNotes Sharing Model
The new Note-taking tool uses the ContentNote object which is based on the ContentVersion (Salesforce Files) object. The Notes are related to other records like Accounts, Contacts, etc. via ContentDocumentLink junction object.
Unlike the old Note-taking tool which uses the Note object, the sharing model and record access to ContentNote and ContentVersion is very particular.
As an admin with “Modify All Data” you can export any classic Note record simply using Data Loader. However, with ContentNote and ContentVersion you can only export the records that are explicitly shared with you or that you own.
This means that even as an admin that using Data Loader is far more difficult to export all the ContentNotes and ContentVersions in your org. Lame-sauce.
There is a workaround and that is to query on ContentDocumentLink record and through parent relationship SOQL syntax retrieve information about the ContentVersion. But this workaround is a bit beastly and at one point in my conversation with Libby I tried to explain it…
Sorry Libby! I know, I know… I’m not even speaking English in that answer let alone describing any sustainable process. But I was determined, there had to be an easier way to export the data. And then it hit me.
As I’ve previously described in 9 Easy Ways to Export Data as .CSV, Salesforce has a Data Export feature to retrieve all data in your org, regardless your sharing settings. Now we’re talking! We can use the Data Export feature to download all our org’s ContentNotes and Notes without any SOQL Wizardry.
- In Setup, navigate to Data Management | Data Export
- Click on either Export Now or Schedule Export button, whichever is available
- Choose file encoding (I recommend 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)
- Click Save button
- Wait for email titled “Your Organization Data Export has completed” which includes link to your generated export (this may take several hours or a few days depending on volume of data)
- Click the link in the email
- Download the zip file(s) that were generated
- The zip file(s) contain .csv files for the objects exported.
- You’ll also 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. Remember, ContentVersion object is common object that includes both Salesforce Files and Enhanced Notes. You will need to filter the “ContentVersion.csv” file by column “FileType” to “SNOTE” records only.
- For each “Id” in “ContentVersion.csv” file whose “FileType” column is “SNOTE” then in the folder “ContentVersion” exists a file with same name as the “Id” column value. The data inside that file is the actual note content with any plain text or rich-text formatting.
If you’re playing with Notes, you might also be interested in my project to Convert Classic Notes to Enhanced Notes to take advantage of the new Note-taking tool.