SetEnvironmentVar (NotesSession - LotusScript®)

Sets the value of a string or numeric environment variable.

Defined in



Call notesSession .SetEnvironmentVar( name$ , valueV [, issystemvar ] )



String. The name of the environment variable to set.


Variant. The value of the environment variable. Date values are converted to strings.


Boolean. Optional. If True, no dollar sign character ("$") is prepended to the variable name. Defaults to False.


User must be a member, or a member of a group that is explicitly stated in the list of who can run unrestricted LotusScript® or Java agents. This list can be found on the security tab in the server's server document which is contained in the server's Name and Address book.

If an environment variable called name$ already exists, it gets the new value. Otherwise, a new environment variable is added to the notes.ini (or Notes® Preferences) file.

SetEnvironmentVar prepends a dollar sign character ("$") to the name$ before setting the value of the environment variable, unless you specify issystemvar as True or have already included a "$" as the first character of the name$. When you examine the environment variable in the notes.ini (or Notes® Preferences) file, you see the "$" character. When retrieving environment variables with the GetEnvironmentString or GetEnvironmentValue methods, you have the option of including or omitting the "$" from the variable name.

If a script runs on a workstation, the user's environment variable is set. If a script runs on a server, the server's environment variable is set, subject to administrative restrictions. For more information, see "Restricting agents on servers" in Administration Help or Administering the Domino® System.


If valueV is not an appropriate data type, SetEnvironmentVar raises the error: "Environment variables must be strings, dates, or integers."