2012-02-17 24 views
0

不知道我在做什麼錯的,但這裏是代碼試圖appendDocLink時收到錯誤消息是SSJS

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動作表達式 腳本解釋器錯誤,行= 13,col = 8:[TypeError]未找到方法NotesRichTextItem.appendDocLink(NotesXspDocument)或非法參數,當我註釋掉第13行時其餘代碼正常工作,發送電子郵件與我正在嘗試傳遞給電子郵件的文檔中的內容進行比較。

回答

5

幾件事...

首先確保你的NSF有一個默認的視圖設置。如果沒有默認視圖,Doclinks將不起作用。您可以通過在設計師的一個視圖旁邊出現一顆金色星星來判斷是否存在默認視圖。

從錯誤消息看來,它看起來像在傳遞NotesXspDocument到appendDocLink方法而期望NotesDocument。的第一行代碼確實應該

var currDoc:NotesDocument = currentDocument.getDocument(true) 

此外,已經將文檔保存在這一點上,如果沒有,那麼你應該添加一行

currDoc.save(true,true) 

,這將確保該文件是保存,您不能發送沒有文檔UNID的DocLink,並且未保存的文檔不會有有效的UNID。

+0

**完美的**第一行做到了。 – 2012-02-20 08:31:33