Root Cause for ’Type mismatch in method OP_UNARY’
Thomas Hampel
21 March 2016Quickly creating a mail with Buttons containing LotusScript can cause headaches.
It just takes a few lines of code for running into undocumented error messages here is a small example:
will result in:
Changing "if not ..." to "is ..." like shown here
will result in a slightly different error message "Type mismatch in method IfCoerceBool: Unknown found, Uknown expected"
Do you spot the problem???
What is the root cause?
The property "IsNewDoc" acutally is a property of NotesUIDocument but is not a valid property of the NotesDocument class.
For testing if a NotesDocument is a new document, use the property IsNewNote
When creating a new button within the body of a new mail, Option Declare is not enabled by default like it is in the Designer client, so the error was not detected when saving the source code.
with Option Declare enabled its easier to spot the problem...
Reminder:
- Option Declare is your friend