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
Akshay MenseAkshay Mense 

How to make use notes object in salesforce

Hello Guys, 

I want to implement custom LWC component which will add comments against particurlar objectives.How can we make use of Notes object so that we can add comments
against each record in salesofrce. Can you please let me know the approach the same. 
Abhishek BansalAbhishek Bansal
Hi Akshay,

It would be easy to store the comments in a new field on the record as compare to the Note object. If you still want to go with Note object than follow the below steps:
  1. Create a wrapper class and add two properties. One to hold the record and other to hold the comments. In this way you will bind the comments with records.
  2. Now pass this wrapper class to your apex class while saving the data.
  3. Now for each record create a note where description would be the comments properties from the warpper class and parentId would be record id from wrapper class.
  4. In this way you can store notes under each records.
Let me know if you have any doubts.

Thanks,
Abhishek Bansal.