How to capture ParentId in ContentNote Salesforce
Notes created with the enhanced note tool and this feature available from Winter’16. This object is available in API version 32.0 and later
While create a Notes in account, where to specify the Account Id in Content Notes. usually while insert any of the object like Attachment, we trying to specify the related object id under the ParentID field, but while create a notes to Account into ContentNotes, specify the Account Id to LinkedEntityId field under the ContentDocumentLink Object.
ContentNote conNote = new ContentNote( Title = 'TheBlogReaders.com', Content = Blob.valueOf('TheBlogReaders.com') ); insert conNote; //Insert Content Note //create ContentDocumentLink record ContentDocumentLink conDocLink = New ContentDocumentLink(); conDocLink.LinkedEntityId = '0066F00000qNVUv'; // Specify Account ID here conDocLink.ContentDocumentId = conNote.Id; //Content Note Id conDocLink.shareType = 'V'; insert conDocLink;
Here ShareType is either V, C and I
V = Viewer permission. The user can explicitly view but not edit the shared file.
C = Collaborator permission. The user can explicitly view and edit the shared file.
I = Inferred permission. The user’s permission is determined by the related record. For shares with a library, this is defined by the permissions the user has in that library. Inferred permission on shares with libraries and file owners is available in API versions 21.0 and later. Inferred permission on shares with standard objects is available in API versions 36.0 and later.
Import ‘Notes’ to the ‘ContentNote’ object with Data Loader – https://help.salesforce.com/articleView?id=000339316&language=en_US&type=1
Pro Tip: Boost Note-Taking with Enhanced Notes in Lightning Experience – https://admin.salesforce.com/pro-tip-boost-note-taking-enhanced-notes-lightning-experience