尝试 appendDocLink 时收到错误消息是 SSJS [英] Getting an Error message when trying to appendDocLink is SSJS

查看:33
本文介绍了尝试 appendDocLink 时收到错误消息是 SSJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知道我做错了什么,但这是代码

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

第 13 行的问题(出现的可能性有多大)执行 JavaScript 动作表达式时出错脚本解释器错误, line=13, col=8: [TypeError] Method NotesRichTextItem.appendDocLink(NotesXspDocument) not found,或非法参数,当我注释掉第 13 行时,其余代码工作正常,发送包含以下内容的电子邮件我试图传递给电子邮件的文档.

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.

推荐答案

几件事...

首先确保您的 NSF 具有默认视图设置.如果没有默认视图,Doclinks 将无法工作.您可以通过设计器中的一个视图旁边是否有一个金星来判断是否有默认视图.

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.

从错误消息看来,您将 NotesXspDocument 传递到 appendDocLink 方法中,而它需要 NotesDocument.第一行代码应该是

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)

这将确保文档被保存,如果没有文档 UNID,您将无法发送 DocLink,并且未保存的文档将没有有效的 UNID.

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.

这篇关于尝试 appendDocLink 时收到错误消息是 SSJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆