获取Lotus Notes的父UNID时出现“无效的通用ID”错误

时间:2011-01-19 05:36:58

标签: lotus-notes lotusscript

我已经编写了以下代码来获取响应文档的父UNID。但我收到“无效的通用ID”错误。但是当我使用“$ Ref”创建doclink时,我可以使用doclink访问父文档。我想访问父文档并更改父文档中的一个字段。任何人都可以提出任何建议吗?

Dim session As New NotesSession
Dim db As NotesDatabase
Dim uiwork As New NotesUIWorkspace
Dim uidoc As NotesUIDocument

Dim doc As NotesDocument  
Dim parent As Notesdocument     

Set db = session.CurrentDatabase 
Set uidoc=uiwork.currentdocument
Set doc = uidoc.Document

'Set parent = db.GetDocumentByUNID(doc.ParentDocumentUNID)
Set parent = db.GetDocumentByUNID("doc.$Ref")
'both methods are giving same error

2 个答案:

答案 0 :(得分:3)

doc.isresponse会返回什么?

使用父unid应该没问题。然而

==>设置parent = db.GetDocumentByUNID(“doc。$ Ref”)

无效,应该是:

if doc.hasItem("$Ref") then
   Set parent = db.GetDocumentByUNID(doc.~$Ref(0))
end if

if doc.hasItem("$Ref") then
   Set parent = db.GetDocumentByUNID(doc.getItemValue("$Ref")(0))
end if

答案 1 :(得分:0)

谢谢蒂姆。我在QuerySave中编写了代码并且工作正常。它提供了无效的UNID,因为我在保存文档之前试图获取它。