Invalid UNID when editing documents

I have documents in a folder that have a field AUNID which is filled with the unique id of a specific child doc. On the folder's action bar I have a button which is supposed to open the document related to the AUNID for editing by the user.

When the action button is pressed, it gives the user the following error:

Invalid UNID; UNID must be a 32-digit hex string.

After pressing 'Ok', however, the correct document opens for editing. I have used the debugger and the code is all executing exactly how I anticipate, however this error pops up for what seems like no reason.

Here is my code:

Sub Click(Source As Button)
    On Error Goto handleError
    Dim ws As New NotesUIWorkspace
    Dim s As New NotesSession
    Dim leaddoc As NotesDocument
    Dim action As NotesDocument
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim doc As NotesUIDocument

    Set db = s.CurrentDatabase
    Set leaddoc = db.UnprocessedDocuments.GetFirstDocument
    Set view = db.GetView("(ActionsByLead)")
    If (leaddoc.GetFirstItem("AUNID").Text = "") Then
        Msgbox ("There is nothing to edit!")
        Exit Sub
    End If
    Dim uid As String
    uid = Cstr(leaddoc.GetFirstItem("AUNID").Text)
    Set action = db.GetDocumentByUNID(uid)
    Call ws.SetTargetFrame("")
    Call ws.EditDocument(True, action,,,, False) 'Error occurs on this line according to the debugger. 

    Exit Sub 
handleError:
    Resume Next
End Sub

Upvotes: 2

Views: 1231

Answers (1)

Ken Pespisa
Ken Pespisa

Reputation: 22284

Check the form of the child document that you are opening. I suspect there is something during the load of that document that is causing the error, and it isn't related to the action or the AUNID item on the parent document.

Or try creating a new child document and see if the error appears

Upvotes: 4

Related Questions