Search code examples
lotus-noteslotus-dominolotusscriptlotushcl

How to read from a variant variable the NoteID and overgive it to a adminp action?


I do have the following Lotus Script:

Sub Initialize

    ' ... some other code

    Dim adminp As NotesAdministrationProcess
    Dim varNoteID as Variant            

    ' read the noteID from notes document field
    varNoteID = doc.GetItemValue( "notes_document_field_noteid" )(0)
    
    ' Approve the document in admin4.nsf (the following line is failing)
    adminp.Approvereplicadeletion(varNoteID)
        
End Sub

The issue is at following line:

' Approve the document in admin4.nsf
 adminp.Approvereplicadeletion(varNoteID)

Error message i receive is:

Object variable not set in line

What I tried, but always failed is:

adminp.Approvereplicadeletion(varNoteID)

adminp.Approvereplicadeletion(varNoteID(0))

adminp.Approvereplicadeletion(varNoteID.NoteID)

Question:

How can I overgive the NoteID, which is saved in a variant variable, into adminp.Approvereplicadeletion(HERE-NOTEID-IN-VARIANT) ?


Solution

  • Your object variable that is not set has nothing to do with varNoteID.

    varNoteID is not an object but a scalar (the way you assing it) or an array of strings (if you assign it without (0)).

    It is the adminp object that is not set.

    There are a lot of examples in the Domino Designer help. And every one of them contains the following line:

    Set adminp = session.CreateAdministrationProcess("myServer/northeast")
    

    This one is missing from your code. Therefor your "adminp"- Variable is an object that is not set resulting in the message you get.