Hi, I’m trying to create formatted email message in an xpages based application. I can get the basic email to send from selected documents with no problem. However, I want to add some format to the message, starting simple by adding some bold text. I’m new to the development game so please be gentle!The error I get is here:-
The runtime has encountered an unexpected error.
Error source
Page Name:/xCourseDetails.xsp
Control Id: button8
Property: onclick
Exception
Error while executing JavaScript action expression
Script interpreter error, line=30, col=34: [ReferenceError] ‘RichTextStyle’ not found
JavaScript code
1: var courseDoc:NotesDocument = document1.getDocument(true);
2: var viewControl = getComponent(“viewPanel1”);
3: var ids = viewControl.getSelectedIds();
4:
5:
6: courseDoc.save(true);
7: for (i=0;i<ids.length;i++)
8: {
9: if (ids[i] !=null){
10:
11: var delegatedoc:NotesDocument = database.getDocumentByID(ids[i]);
12:
13:
14: var cSubject = courseDoc.getItemValueString(“cTitle”);
15: var dFname = delegatedoc.getItemValueString(“dFname”);
16: var dLname = delegatedoc.getItemValueString(“dLname”);
17: var cStrtDate = delegatedoc.getItemValueString(“cStrtDate”);
18: var cLoc = delegatedoc.getItemValueString(“cLoc”);
19: var emailDoc:NotesDocument = database.createDocument();
20: emailDoc.replaceItemValue(“princpal”, @UserName())
21: emailDoc.replaceItemValue(“subject”, courseDoc.getItemValueString(“cTitle”));
22: emailDoc.replaceItemValue(“form”,“Memo”);
23: emailDoc.replaceItemValue(“from”,@UserName());
24:
25: var mailBody:NotesRichTextItem = emailDoc.createRichTextItem(“Body”);
26: emailDoc.save(true);
27:
28: var bold:NotesRichTextStyle = session.createRichTextStyle();
29: bold.setBold(RichTextStyle.YES);
30:
31: mailBody.appendText("Dear " + dFname + “,”);
32: mailBody.addNewLine();
33: mailBody.addNewLine();
34: mailbody.appendStyle(bold)
35: mailBody.appendText(“You have requested to attend the course '” + cSubject +“'” );
36: mailBody.addNewLine();
37: mailBody.addNewLine();
38: //mailBody.appendStyle(normal);
39: mailBody.appendText("on " + cStrtDate + " " );
40: mailBody.addTab();
41: mailBody.addNewLine();
42:
43: mailBody.appendText(“BOLD?”)
44:
45: mailBody.addNewLine();
46: mailBody.addNewLine();
47: mailBody.addNewLine();
48: mailBody.appendText(“Sent from xxx.”);
49:
50: emailDoc.send(delegatedoc.getItemValueString(“dEmail”));
51: }
52: }
53: context.redirectToPage(“/xCourseList.xsp”)