I can't find them on ContentVersion or ContentDocument. If I create a NEW Enhanced Note, those live on ContentNote. But what about the converted ones? They are no longer on the Note object either.
-
How did you convert your classic notes to enhanced notes?– Jayant DasNov 2, 2018 at 18:33
-
There isn't a programmatic "convert" operation. Conversion apps create new ContentNotes, and might or might not remove the existing Note records. What app did you use? What are you actually seeing in your org?– David Reed ♦Nov 2, 2018 at 19:11
1 Answer
To you convert notes to Enhanced notes you create contentNotes like @DavidReed suggested. Based on you're question I'm guessing you might have used a conversion app something like Convert Notes to Enhanced Notes. Because if you have done it programatically yourself you would know if the old notes was deleted or not.
I started looking at the above mentioned app's source code looks like once the notes are converted the old notes are deleted. So technically this is what might be happening with other apps to just remove duplicate records. Below is some code from the above app ConvertNotesToContentNotesService.cls. Once the Notes are converted the below methods are being called where the old notes are deleted.
private void postProcessConversionResults( Map<ID, ConversionResult> conversionResultsMap ) {
// should we delete the converted notes?
if ( this.options.deleteNotesUponConversion ) {
deleteConvertedNotes( conversionResultsMap );
}
}
// -----------------------------------------------------------------
private void deleteConvertedNotes( Map<ID, ConversionResult> conversionResultsMap ) {
List<Note> notesToDelete = new List<Note>();
for ( ConversionResult conversionResult : conversionResultsMap.values() ) {
if ( conversionResult.status == ConversionResultStatus.CONVERTED ) {
notesToDelete.add( conversionResult.oldNote );
}
}
if ( notesToDelete.size() > 0 ) {
delete notesToDelete;
}
}