Examples: Send method (NotesUIDocument - LotusScript®)

This script sets the contents of the SendTo field based on the contents of the Status field, and then mails the document. Before the document is saved, the SendTo field gets the manager's name if the Status is New, the HR contact's name if the Status is Approved, and the employee's name if the Status is rejected.

Sub Querysave(Source As Notesuidocument, Continue As Variant)
  s = source.FieldGetText( "Status" )
  Select Case s
  Case "New" :
    Call source.FieldSetText _
    ( "SendTo", source.FieldGetText( "Manager" ) )
  Case "Approved" : 
    Call source.FieldSetText _
    ( "SendTo", source.FieldGetText( "HRContact" ) )
  Case "Rejected" : 
    Call source.FieldSetText _
    ( "SendTo", source.FieldGetText( "Employee" ) )
  End Select
  Call source.Send
End Sub