ContentNote
Represents a note created with the enhanced note-taking tool, released in Winter ’16.
Introduced in API version 32.0.
create(), delete(), describeLayout(), describeSObjects(), query(), retrieve(), search(), update()
-
- Notes must be enabled.
- Type: base64
- Properties: Create, Nillable, Update
- Description: The content or body of the note, which can include properly formatted HTML or plain text. When a document is uploaded or downloaded via the API, it must be base64 encoded (for upload) or decoded (for download). Any special characters within plain text in the
Contentfield must be escaped. You can escape special characters by callingcontent.escapeHtml4(). If the input contains unsafe HTML characters or new lines, we automatically strip them out before saving the content.
- Type: datetime
- Properties: Filter, Nillable, Sort
- Introduced: API version 48.0
- Description: The date the document was modified. ContentModifiedDate updates when, for example, the document is renamed or a new document version is uploaded.
- Type: int
- Properties: Filter, Group, Nillable, Sort
- Description: The size of the note in bytes for notes smaller than 2 GB. In API version 66.0 and later, use the
ContentSizeLongfield.
- Type: long
- Properties: Filter, Group, Nillable, Sort
- Introduced: API version 66.0
- Description: The size of the note in bytes, up to 10 GB.
- Type: string
- Properties: Filter, Group, Nillable, Sort
- Description: File extension of the note.
- Type: string
- Properties: Filter, Group, Nillable, Sort
- Description: Type of file for the note. All notes have a file type of
SNOTE.
- Type: boolean
- Properties: Defaulted on create, Group, Sort
- Introduced: API version 34.0
- Description: Indicates whether the note is read only.
- Default value: false
-
Type: reference
-
Properties: Filter, Group, Nillable, Sort
-
Introduced: API version 52.0
-
Description:
Lookup to the note’s ContentBody.
This is a relationship field.
-
Relationship name: LatestContent
-
Relationship type: relationship
-
Refers to: ContentBody
- Type: reference
- Properties: Filter, Group, Nillable, Sort
- Description: ID of the ContentVersion for the latest published version of the note.
- Relationship name: LatestPublishedVersion
- Relationship type: relationship
- Refers to: ContentVersion
- Type: picklist
- Properties: Create, Defaulted on create, Filter, Group, Nillable, Restricted picklist, Sort, Update
- Introduced: API version 41.0
- Description: Controls sharing privacy for a file. Only Salesforce admins and file owners with Collaborator access to the file can modify this field. Default is
Visible to Anyone With Record Access. When set toPrivate on Records, the file is private on records but can be shared selectively with others.
- Type: string
- Properties: Filter, Group, Nillable, Sort
- Introduced: API version 35.0
- Description: A preview of the note’s content.
- Type: string
- Properties: Create, Filter, Group, idLookup, Sort, Update
- Description: Title of the note.
- Use ContentNote to create, query, retrieve, search, edit, and update notes.
- ContentNote is built on ContentVersion, and so it has many of the same usages.
- Not all fields can be set for notes. Only the
ContentandTitlefields can be updated. - The maximum file size that you can upload via the SOAP API is 50 MB. When a document is uploaded or downloaded via the API, it’s converted to base64. This conversion increases the document size by approximately 37%. Account for the base64 conversion increase so that the file you plan to upload is less than 50 MB after conversion.
- You can convert old Note records to Lightning Experience, so users can view and edit notes from the Notes & Attachments related list in Lightning Experience. Users can edit their converted notes, which are accessible from the Notes related list and Notes tab. Copy old Note records to newly created ContentNote records. Users assigned the Set Audit Fields Upon Creation permission can set the owner, created date, and last modified date on ContentNote records.
- SOQL and SOSL queries on the ContentNote return only the most recent version of the note.
- To relate a note to a record, use
ContentDocumentLink. Review theLinkedEntityIDfield inContentDocumentLinkfor a list of objects that notes can relate to.
For example, the following Apex code creates a note and escapes any special characters so they’re converted to their HTML equivalents.
Apex code doesn’t need to be encoded to base64 before it’s uploaded and downloaded.
In this example, the following code creates a note using text that is already formatted as HTML, so it doesn’t need to be escaped.