Invalid Universal ID Error on GetByUNID

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

Subject: Invalid Universal ID Error on GetByUNID

I would add a check to see that you are linking to the WOW database correctly, and that it is opening.

Also, it does not look like you are saving the changes to the WOW document (I realize that is not the problem you are fighting right now…)

After a 2nd look at your code, I see you are trying to save the current document - you cannot do that in a QuerySave, as that will trigger a recursive call back into QuerySave.

Subject: RE: Invalid Universal ID Error on GetByUNID

Graham,

Thanks for your response and for noting the other errors. You caught all the right things!

The funny thing is that my path to the other database was wrong. Nothing like things like that to make you feel humble.

Thanks again!

Josh