Examples: ComputeWithForm method

This script creates a new document in the current database, sets its Form item to "Notification," and sets the value of the Topic item. The Notification form has the following input validation formula for the Subject field:

@If( Subject = ""; @Failure( "You must enter a Subject" ); @Success )

Because the script has not created a Subject item on the document, validation fails, ComputeWithForm returns False, and the document is not saved.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim success As Variant
Set db = session.CurrentDatabase
Set doc = New NotesDocument( db )
doc.Form = "Notification"
doc.Topic = "Large bodies of water"    
success = doc.ComputeWithForm( False, False )
If success Then
  Call doc.Save( True, True )
End If