User Management Resource Administrator intensively uses variables. Variables
are placeholders for actual values. A variables consists of 2 items:
The name of the variable
The value of the variable.
By default, variable names are enclosed with %-characters. The %-characters
are considered part of the variable name. Examples of variable name are:
%FirstName%, %Domain%, %OU%. The value of a variable does not always exist
and may change in time. Typically, a variable name is used in some specification
and at run-time, the name of the variable is replaced by the current value
of the variable.
In User Management Resource Administrator, variables are used to specify
properties
of script actions. For more background information on projects, scripts,
actions and properties, see Principle
of operation. There are 2 main reasons to specifying the value of
a property using a variable: Link the
input data to the script and simplify the configuration of script action
properties.
Link input data to script
Supposre you are working on a mass project. If you want to use
the value of a column from the input data in a script, you need to use
variables. In the example shown, the second column of the input data contains
the last name of the user accounts that must be created. For script action
Create user (AD)
the value of property SurName is set to variable %LastName%. Next, the second column is linked to variable
%LastName%.
In the figure shown, the input data
contains a column linked to variable %LastName%. The script of the project
contains the property SurName in script action Create
user (AD). By resolving the
variable, the property gets a value that equals the value of the corresponding
column of the input data
To link a column to a variable, simply
right click in the column header. The popup menu shows all available variables.
Select the variable. This will set
the link between the column and the specified variable. With this method,
you can only map columns to variables that are in use by properties of
the script. When the project is executed, the application reads a line
from the input data and sets the value of the specified variable to the
value of the column for the current input data line. As an alternative,
you can also open the project properties: View,
Properties, select tab Variables. Select
the column of interest and press Edit.
The column properties window
is shown.
In this window, you see the name
of the column and the current variable linked to the column. The lower
section of the window shows all script actions where the specified variable
is used. For each action, the property that contains the variable and
the property value is shown. To select another variable, open the variable
list and select the variable. To select a variable that is not used yet
in any script action property, simply type the variable name.
Simplify the configuration of script
action properties
Another reason to use variables is
to simplify the configuration of multiple properties and script actions
even if the value is the same for all input data lines, e.g. each time
the script is executed. It is very well possible that multiple action
properties of different or the same script actions must obtain the same
value. For instance, the name of the domain might be used in multiple
properties when creating user accounts. Suppose the name of the domain
is fixed and the same constant value for all user accounts that must be
created. Then instead of specifying the same domain name for each script
action property, a variable %Domain% can be used. This variable should then be
specified as the value for all properties that use this specification.
In the beginning of the script, the variable
assignment action should be specified. Only at this location, the
real
domain name is specified.
Variable set (advanced)
For advanced script configuration, it is important to understand how
and when variables are created and destroyed. This section gives a little
background information on this topic. In User Management Resource Administrator,
all variables are destroyed when a script is executed. During the execution
of a single script, e.g. multiple script actions, a variable
set exists. A variable
set is a collection of variables.
In a variable set each variable has a value. Before the first
script action is executed, the columns that are linked to variables a
loaded into the variable set. In a simple straightforward script, this
variable set
will not change.
In a script action one or more of
the following changes can be applied to the variable
set:
A new variable-value
pair is added to the variable set:
This happens when the property of a script action is configured as an
output variable. Upon execution of the script action, the variable set
now contains the new variable-value. This mechanism is mainly used when
one script action is somehow dependent on a previous action. Example:
the action Create user (AD) can generate a unique username of a user
account automatically. This name is also used when a home
directory is created for the
user account. Since the username is not known in advance, it is generated
by the action Create user (AD). During the execution of the action, the
value of the username is added to the variable
set. Subsequent actions can
then use the new created variable. In order to add the value of a property
as a variable to the variable
set, open the properties of
the property and select the Output tab. In User Management Resource Administrator,
this mechanism is used for a number of properties. For these properties
the variables are configured to output the value to a variable by default.
Note: as a separate script action,
you can insert the Script Action: Log Variables to log all variables of the variable set
to the log window. This might help you to setup more advanced scripts.