Greetings – I know this has been a popular topic and I’ve tried to review all of the related threads, but I still can’t seem to make the GetDocumentByUNID function work - always get an Invalid Universal ID message.
The following code is run as an agent from a document in on QuerySave and attempts to update a document in another database (Wow). The docID I’m referencing has already been saved on the document.
Additionally, all my messageboxes return valid responses, and I’ve verified that the UNID is correct on the document I’m attempting to pull. I’ve also tried this in a button incase if the agent or QuerySave was a problem. I’m stumped.
Dim session As New NotesSession
Dim wowdb As New NotesDatabase( "server", "dbname.nsf" )
Dim wowdoc As NotesDocument
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim impdoc As NotesDocument
Dim key As String*32
Set uidoc = workspace.CurrentDocument
Set impdoc = uidoc.Document 'the IMP document that is currently open
If Not impdoc.w_docid(0) = "" Then
Call impdoc.Save(False, False)
key$ = impdoc.w_docid(0)
Messagebox(wowdb.Title)
Messagebox(key$)
Set wowdoc = wowdb.GetDocumentByUNID(key$)
wowdoc.w_imp_analyst = impdoc.ia_implement
wowdoc.w_to_imp_rev = impdoc.w_start_implementation
Else
Messagebox("Barf!")
End If
Any suggestions are more than appreciated!
Thanks,
Josh