function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gary StomGary Stom 

Querying Content from ContentNote Object

I am attempting to retrieve the HTML Rich Text field "Content" from ContentNote object, but results are not rich text. The closest I can get is the following query:
Select TextPreview, Content from ContentNote where id = '069...'
TextPreview gives me the text, but not HTML. Content gives me an alphanumeric coded field, but not rich text.

What I need is the actual text with HTML codes like a rich text field. What field/object can I query to retrieve the rich text from the content note object? If I can't, is there a trigger I can write to migrate that value on another object that I can query with rich text?
Tim BarsottiTim Barsotti

The field you are looking for is "Content" - it is base64... So if you record is CN - then CN.Content.toString() would display the html value.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentnote.htm