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

NotesAndAttachements - Custom Object

It is more of feasibility question. 


What I have created

1. Custom Object with Notes and Attachements Option enabled.

2. Visual Force Page - where I put in a text field for allowing to enter Notes.



Question -


Is it possible to put the comments from the text boc in Apex page into the object?


- Samarthya


Is it possible to put the comments from the text boc in Apex page into the object?

Yes, it is possible to put the comments into the object. You should use the custom controller to do this. in the custom controller you will have to create the instance of "Note" Standard Object as follows.

Note nt = new Note();

nt.Body = "comments entered into textbox on the apex page";

nt.ParentId = custom Object RecordID;

nt.Title = "Notes Title ";

List<Note> liNote = new List<Note>();


create liNote;


let me know if you face any problem.


Thanks I will try it. :)



It does not compiles and gives error - Compile Error: Duplicate variable: liNote (attempt to re-create the variable with type: create) at line....


It comes everytime on the line create liNote, :(


sorry the last line should be

insert liNote; //instead of create liNote;


were you able to achieve it?


Yes it does! Thanks!


How can I put the notes section on custom report if I want to view all the columns + Notes on it.


I did add the relative list to the layout and it still is not showing up.