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
Nikhil SagarNikhil Sagar 

Can anyone help me on this "Can we write trigger on Note in salesforce lightning" not in salesforce classic.

Best Answer chosen by Nikhil Sagar
ShivankurShivankur (Salesforce Developers) 
Hi Nikhil,

Please note Orgs with Enhanced Notes active do not create Note records, which represents classic Notes.

Instead, they create ContentNote records, which are part of a much more complex ERD. ContentNote doesn't have a ParentId field (its relationship to records is many-to-many), so your trigger would have to be on the ContentDocumentLink object.

ContentNote is basically a facade on the underlying ContentDocument and ContentVersion objects, but you can identify the note records by the FileType field:
All notes have a file type of SNOTE.

Be aware that ContentDocumentLink is used for linking all Content records (not just notes) to sObjects, and that there are unique restrictions on querying it that are described in the documentation linked above.

Get more detail about this object:
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentnote.htm

Hope above information helps. Please mark as Best Answer so that it can help others in future.

​​​​​​​Thanks.

All Answers

ShivankurShivankur (Salesforce Developers) 
Hi Nikhil,

Please note Orgs with Enhanced Notes active do not create Note records, which represents classic Notes.

Instead, they create ContentNote records, which are part of a much more complex ERD. ContentNote doesn't have a ParentId field (its relationship to records is many-to-many), so your trigger would have to be on the ContentDocumentLink object.

ContentNote is basically a facade on the underlying ContentDocument and ContentVersion objects, but you can identify the note records by the FileType field:
All notes have a file type of SNOTE.

Be aware that ContentDocumentLink is used for linking all Content records (not just notes) to sObjects, and that there are unique restrictions on querying it that are described in the documentation linked above.

Get more detail about this object:
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentnote.htm

Hope above information helps. Please mark as Best Answer so that it can help others in future.

​​​​​​​Thanks.
This was selected as the best answer
Nikhil SagarNikhil Sagar
Thanks Shivankar..