1

I hvae created a new custom button "craete opportunity" on my custom object which will create 10 opporutunity at a time which is VF page. Now i need to add the "notes" to my opportunity which each opportunity will have notes.Note field is an long text area, value typed here must be saved as a notes in that particular opportunity. This note field should be below that opportunity. Can any one tell how to do this using Vf and apex code. also tell me any links for this, waiting for your reply. Thanks in advance.

Current VF Page

Regards

Lavanya.

3

I assume you are talking about adding the text from that notes field into the note&attachement section of opportunity record. You can do so by using the below code.

note n = new note();
n.parentId= '0000000XXXXXXX; //Id of the opportunity for which you want to add this note
n.body='inserting note from code'; // body of the note. this should be populated from the notes field that you have shown in the screenshot
n.title='New Note from code'; // the title of the note
n.isPrivate=false;  // if private it will be visible only for the owner and any user with modify all permission
insert n; //insert the record

find more info here http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_note.htm#topic-title

In your case what you should do is, first insert the opportunity and then take the opportunity id and then insert the note.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.