Lotus notes &引用;无效的通用id“;获取Lotus notes的父UNID时出错

Lotus notes &引用;无效的通用id“;获取Lotus notes的父UNID时出错,lotus-notes,lotusscript,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 NotesDo

我编写了以下代码来获取响应文档的父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

isresponse医生返回了什么

使用父unid应该可以。然而

==>Set parent=db.GetDocumentByUNID(“doc.$Ref”)

无效,应为:

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


谢谢你,蒂姆。我在QuerySave中编写了代码,效果很好。它提供了无效的UNID,因为我试图在保存文档之前获取它

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