I have a button in the action bar that composes a form inheriting the value in a field “parentID” that is computed when composed with @documentUniqueID from the document beeing opened…
the value is inhereted fine, the new document is saved. and in the querysave there is code with getdocumentbayuniqueID useing the value in the hidden field that contains the unique ID of the parent document and then I get the error “invalid Universal ID”. I dont see why… any clues??
Here is the code… the ID fields are @Text(@documentuniqueid)
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim cdoc As NotesDocument
Set cdoc = uidoc.Document
Dim session As New NotesSession
Dim db As NotesDatabase
Dim Ldoc As NotesDocument
Set db = session.GetDatabase(cdoc.Server(0),"\iextensions\IENLeads.nsf")
Set Ldoc = db.GetDocumentByUNID(Cstr(cdoc.IENContactDocID(0)))
Dim strvalue As String
strvalue = (cdoc.IENUserActKey03Value(0) + " " + cdoc.Call_log(0) + " " + cdoc.CreatedBY(0)) + " " + Str(cdoc.Created)
Ldoc.Comment = strvalue
Call Ldoc.Save(True,True)
I suppose you’ve already found a solution and/or moved on, but for what it’s worth, I plugged your code into a test database and I didn’t have any problems with the getDocumentByUNID. The only code I changed in your script was I didn’t use the same path in the “set db” call. If you’re already in the database, why not just use session.CurrentDatabase()?
I found the problem, this document had a replication conflict a long time ago, and the man doc along with the conflicting doc were merged creating a new doc, the fiel I was referencing was computed when composed so it neve got the new UID. So when I did getdocumentByUniqueID useing the parents UID in the child doc I got that error, cause there is no longer that UID in the database.