AX2539

Using job variables

You can use job variables within a Scheduler job, to define the value of the variable when the job is run. Job variables are managed in the Job Variables section of the job.

There are two types of variables:

  • User-defined variables: You can create a variable and then use it within any job or task setting that supports variables, but only within that particular job. The primary use for user-defined variables is to run a job via RunEvent (either the function or the command), and pass in a variable value at that time.

  • System variables: Axiom Software provides a number of system variables that can be used within relevant job and task settings. For example, instead of specifying a "hard-coded" email address for the job notification, you can use a system variable to specify that whoever ran the job should receive the notification.

In all cases, to use a variable within a job or task, enter the variable name into the desired setting, enclosed in curly brackets. For example: {variable}

TIP: If you want to use a variable in a job, you can right-click the variable and then select Copy variable name to clipboard. Navigate to the setting where you want to use the variable, and then paste it into the setting (the curly brackets are added automatically).

At the job level, variables can be used in any of the Notification Message Content settings in the Notification tab. At the task level, in general, variables can be used in any task field that accepts typed user input.

When the job is run, the variable values used for the job display in the job results under Job Values, and also in the email notification (if applicable).

User-defined variables

User-defined variables are created in the Job Variables tab. You define the name of the variable (without brackets), and if desired, define a default value for the variable.

When the job is run, the user-defined variable will be replaced with a value as follows:

  • If the job was scheduled using RunEvent (function or command), and RunEvent sent a name / value pair that matches the name of the job variable, that value is used.

  • If the job was scheduled as a result of a file group trigger, and the trigger has a defined variable that matches the name of the job variable, that value is used. Multiple values are returned as a comma-separated list.

  • If the job contains a Process Document List task or a Process Plan Files task with a defined post-processing variable that matches the name of a job variable, that value is used after that task has been processed.

  • Otherwise, the default value defined in the Job Variables tab is used.

If the value is blank, then the job or task setting using the variable will be evaluated as blank. If the setting cannot be blank, then an error will result when the job is executed.

System variables

The available system variables are listed at the bottom of the Job Variables tab. Most of these variables relate to user names and addresses, for use within the job notification settings.

When the job is run, the system variable is replaced with the applicable system value.

The following values are available:

Variable Description

{CurrentUser.EmailAddress}

{CurrentUser.LoginName}

{CurrentUser.FullName}

Returns the current user's email address, login name, or full name.

The current user is the user identity under which the job is currently being run. Generally, this is the user who executed the job. If the job was executed via an event handler and the event handler is set to owner, then the current user will be the job owner.

{JobOwner.EmailAddress}

{JobOwner.LoginName}

{JobOwner.FullName}

Returns the job owner's email address, login name, or full name.

The job owner is the user who last saved the job.

{Scheduler.ConfiguredFromEmailAddress}

Returns the system's default "from" address, as defined in the system configuration settings.

{Scheduler.FromEmailAddress}

This returns a value as follows:

  • If the current user belongs to a subsystem, this returns the subsystem administrator's email address.
  • If the current user does not belong to a subsystem, this returns the default configured "from" address.

{CurrentSubsystem.AdminEmailAddress}

Returns the email address of the subsystem administrator for the subsystem that the current user belongs to.

  • If the subsystem has multiple administrators, the email is sent to the first administrator.
  • If the user belongs to multiple subsystems, the first returned subsystem for the user will be used. No specific logic is applied to determine the "correct" subsystem for any particular job.
  • If the user does not belong to a subsystem, then no email address is returned.

{EventHandler.EventName}

Returns the name of the event handler that caused the job to be scheduled, if applicable. Otherwise the variable returns blank.

{NotificationAddress}

Returns the notification address defined for the plan codes that triggered a Scheduler job.

This variable only applies when the job is executed as a result of a file group trigger, and only if the optional notification address settings are defined for the file group. Otherwise, no email address is returned.

For more information, see Using email notifications with triggers.

{Task.CurrentIterationValue}

{Task.IterationNumber}

Returns the current iteration value and the current iteration number. These variables only apply when using the Iteration feature for a task.

For more information, see Using iterative task processing.