Script equivalent to @IsValid
We really like the @IsValid formula to check to see if a document is valid before performing another operation, but sometimes we're not using formula language, so a script equivalent is needed.When writing script and you want to find out if the current document has any validation errors, use this code:
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
On Error Resume Next ' Trap errors
Call uidoc.Refresh
On Error Goto 0 ' Reset the error handler
If Err <> 0 Then
Err = 0 ' Clear it, or else next time it will be set even if there is not an error
Exit Sub ' Exit out since the validation failed
End If
' ... continue with your code