Is there a way to create a ContentNote linked to an Account, like we do with Notes using ParentId, and set it as public upon creation?
Thank you!
you can create a ContentNote and link it to an Account.
the process for ContentNote involves using ContentDocumentLink to associate the ContentNote with the desired record.
Create a content note -
ContentNote note = new ContentNote();
note.Title = 'Sample Note Title';
note.TextPreview = 'Summary of the note';
note.Content = Blob.valueOf('This is the content of the note.');
insert note;
Link the ContentNote to an Account -
ContentDocumentLink link = new ContentDocumentLink();
link.ContentDocumentId = note.Id;
link.LinkedEntityId = '001XXXXXXXXXXXXXXX';
link.ShareType = 'V'; // Set as 'V' for view-only (public)
link.Visibility = 'AllUsers'; // Makes the note publicly accessible
insert link;
Remember -
Ensure that the running user has appropriate permissions to create ContentNotes and link them.
The Visibility field determines who can view the ContentNote. Using AllUsers makes it publicly accessible to anyone who can see the related Account.
Let me know if this solves your issue.
Thanks!
Monika (SFDC Girl)