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
SamarthyaSamarthya 

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

srikanth123srikanth123

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>();

liNote.add(nt);

create liNote;

 

let me know if you face any problem.

SamarthyaSamarthya

Thanks I will try it. :)

SamarthyaSamarthya

 

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, :(

srikanth123srikanth123

sorry the last line should be

insert liNote; //instead of create liNote;

srikanth123srikanth123

were you able to achieve it?

SamarthyaSamarthya

Yes it does! Thanks!

SamarthyaSamarthya

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

SamarthyaSamarthya

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