Examples: SetEnvironmentVar method
- This script sets the value of the HomeTown environment variable
to "Salvador." The following line gets added to the user's notes.ini
(or Notes® Preferences) file:
$HomeTown=Salvador
Dim session As New NotesSession Call session.SetEnvironmentVar( "HomeTown", "Salvador" )
- 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