Search code examples
lotusscript

Type mismatch in method RunStkCoerceVal in Lotusscript


First of all I want so say, that I'm a very beginner in developing a Domino Application. So please consider this fact when answering my possibly dumb question.

I have the following problem:
When I execute the following code, it runs into the 1st MsgBox which shows up just normal. But it does not run into the 2nd MsgBox! Instead I get the following error message:

Type mismatch in method RunStkCoerceVal in Lotusscript agent STRING found Null expected.

Here is the code:

    Dim session As NotesSession
    Dim db As NotesDatabase
    Dim ws As New NotesUIWorkspace
    Dim thisDoc As notesUIDocument
    Dim docSMBPrivateProfile As notesDocument
    Dim test As Variant

    Set session = New NotesSession
    Set db = session.CurrentDatabase
    Set thisDoc = ws.CurrentDocument
    Set docSMBPrivateProfile = db.GetDocumentByUNID(thisDoc.FieldGetText("SMB_PRIVATE_PROFILE_DOCUMENT_ID"))

    Msgbox("This message will appear")
    Set test = docSMBPrivateProfile.FieldGetText("DOCUMENT_ID_TEST")
    Msgbox("This message won't appear")

Please note that the call thisDoc.FieldGetText("SMB_PRIVATE_PROFILE_DOCUMENT_ID") works normal just as expected.

I set the data type of test to Variant in order to avoid type mismatch problems. In fact I expect a String.

The only topic I found about this problem is found here: http://www.secure-eserver.com/?p=3431 But I'm not able to make head or tail of it.

Can you please provide me any help?


Solution

  • docSMBPrivateProfile is based on NotesDocument class which does not have FieldGetText method. Use test = docSMBPrivateProfile.GetItemValue("DOCUMENT_ID_TEST")(0) instead.