Question

Not sure what I'm doing wrong, but here is the code

1: var currDoc:NotesDocument = currentDocument;
2: var doc:NotesDocument = database.createDocument();
3: doc.replaceItemValue("form", "Memo");
4: doc.replaceItemValue("sendTo", currDoc.getItemValueString("responsible"));
5: doc.replaceItemValue("subject", currDoc.getItemValueString("replySubject"));
6: var rtitem:NotesRichTextItem = doc.createRichTextItem("Body");
7: rtitem.appendText("The following more information request has been answered:");
8: rtitem.addNewLine(2);
9: rtitem.appendText("Subject: " + currDoc.getItemValueString("replySubject"));
10: rtitem.addNewLine(2);
11: rtitem.appendText("Reply Text: " + currDoc.getItemValueString("replyText"));
12: rtitem.addNewLine(2);
13: rtitem.appendDocLink(currDoc);
14: doc.send();

Problem on line 13 (what are the chances of that) Error while executing JavaScript action expression Script interpreter error, line=13, col=8: [TypeError] Method NotesRichTextItem.appendDocLink(NotesXspDocument) not found, or illegal parameters, when I comment out line 13 the rest of the code works fine, sends the email with the content from the document I am trying to pass to the email.

Was it helpful?

Solution

Couple of things...

First of all make sure that your NSF has a default view setup. Doclinks won't work if there is no default view. You can tell if there is a default view by the presence of a gold star beside one of the views in designer.

From the error message it looks like your passing a NotesXspDocument into the appendDocLink method while it is expecting a NotesDocument. the first line of code should really be

var currDoc:NotesDocument = currentDocument.getDocument(true)

Also, has the document been saved at this point, if not then you should add a line

currDoc.save(true,true)

and this will make sure that the document is saved, You can't send a DocLink without the document UNID and an unsaved document will not have a valid UNID.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top