These two form scripts work together to set and retrieve the HomeTown
environment variable. The first script places the contents of the
HomeTown environment variable into the HomeTown field of a newly created
document. Every time the user composes a document with the form, the
HomeTown field is automatically filled in with the value of the environment
variable. The second script places the contents of the HomeTown field
into the HomeTown environment variable whenever the user saves the
document.Sub Postopen(Source As Notesuidocument)
Dim session As New NotesSession
town = session.GetEnvironmentString( "HomeTown" )
If source.IsNewDoc Then
Call source.FieldSetText( "HomeTown", town )
End If
End Sub
Sub Querysave(Source As Notesuidocument, _
Continue As Variant)
Dim session As New NotesSession
Call session.SetEnvironmentVar _
("HomeTown",source.FieldGetText("HomeTown"))
End Sub