Implicit and explicit variables

An important feature of scripting is implicit and explicit variables. Explicit variables are explicitly defined and bound in the Variables tab in the Automation Scripts application. Implicit variables are not explicitly defined in the Variables tab and are provided by the scripting framework.

Implicit variables follow the convention over configuration pattern where the framework intelligently injects variables at run time that might otherwise have needed Java coding to fetch and set. Some implicit variables are injected based on how the explicit variables are defined and some are injected irrespectively. The following table lists and describes implicit variables.

Table 1. Implicit variables
Name Type Description Applicability
app String The name of the Maximo application that initiated the running of the script. All launch points dealing with a Maximo business object (MBO) or MBOSET
user String userid of the user whose action initiated the script execution. All launch points dealing with an MBO or MBOSET
mbo psdi.mbo.Mbo The current MBO in the context of the running script. For example, in case of the object launch point this will be the MBO, which is generating the events for the scripting framework. For attribute launch point this is the attributes owner MBO. For action launch point this may be the escalation or workflows MBO. All launch points dealing with an MBO or MBOSET
mboname String The name of the current MBO in the context of the running script. All launch points dealing with an MBO or MBOSET
errorkey String This variable is for throwing MXExceptions from the script without having to explicitly import or refer to that API. This refers to the error key in the MXException. It works together with the errorgroup and the params implicit variables. The MXExceptions API is the standard way to throw Exceptions from Maximo-based components. The exception message is translated, which is the main advantage of using this API instead of a standard Java exception, which is not translated. Its usage is deprecated and replaced by the service variable’s error(..) function All launch points
errorgroup String Its usage is the same as the errorkey. It points to the error group of the MXException. Together with the errorkey it helps uniquely point to an error message in the Maximo message repository. Its usage is deprecated and replaced by the service variable’s error(..) function All launch points
interactive Boolean It is a Boolean variable indicating whether the script is executed in an interactive or UI session [value true] or a background session [for example, Integration]. This reflects the value of userInfo.isInteractive(). All launch points
evalresult Boolean This is a Boolean variable of type OUT to indicate the result of the condition evaluation. Condition launch point and publish channel event filters
onadd Boolean This Boolean variable indicates whether the MBO in the script is added [new MBO – value true] or not. The script developer can use this for conditional actions or validations based on the state of the MBO. All launch points or callbacks where MBO/MBOSET is involved. Mostly useful for object launch points
onupdate Boolean Boolean variable indicates where the MBO in the script is updated [exiting MBO – value true] or not. The script developer can use it for conditional actions or validations based on the state of the MBO. All launch points or callbacks where MBO/MBOSET is involved. Mostly useful for object launch points
ondelete boolean Boolean variable indicating whether the MBO in the script context is deleted [value true] or not. All launch points or callbacks where mbo/mboset is involved. Mostly useful for Object launch point
action String The name of the action that was generated from the action launch point user interface. Action launch point
scriptName String The name of the script that is run. All launch points
launchPoint String The name of the launch point for which the script is run. All launch points
scriptHome psdi.mbo.Mbo This is the same as the implicit variable MBO. It allows backward compatibility with ICD scripts. Action launch points
wfinstance psdi.workflow.WFInstance The workflow instance MBO. Action launch point. Only when the action is launched from a workflow.
service com.ibm.tivoli.maximo.script.ScriptService The global implicit var available to all scripts. All launch points and callbacks
listMboSet psdi.mbo.MboSetRemote This is used for setting the lookup MBOSET from a lookup script in an attribute launch point. Attribute launch points --lookup scripts.
srcKeys String[] Used for mapping the lookup MBO key to the target MBO key targetKeys. Attribute launch points--lookup scripts.
targetKeys String[] Used for mapping the target MBO key to the lookup MBO key srcKeys. Attribute launch points--lookup scripts.
Some implicit variables are injected into the script based on the explicitly defined variables. The following table describes the implicit variables that are based on explicitly defined variables whose binding type is an MBO attribute. There are no implicit variables for explicitly defined variables of other binding types like literals, maxvars, and system properties. The assumption is that “var” is the explicitly defined variable that binds to an MBO attribute.
Table 2. Implicit variables that are based on explicitly defined variables whose binding type is an MBO attribute
Name Type Description Applicability
var_required Boolean Required flag of the MBO attribute that var binds to. All launch points. The script can modify it if the var is OUT or INOUT.
var_readonly Boolean Read-only flag of the MBO attribute that var binds to. All launch points. The script can modify it if the var is OUT or INOUT.
var_hidden Boolean Hidden flag of the MBO attribute that var binds to. All launch points. The script can modify if the var is OUT or INOUT.
var_internal Same type as the MBO attribute to which var binds to. For synonym domain kind of MBO attributes [like status] this represents the internal [maxvalue] value for the MBO attribute. All launch points. Applicable only if var is bound to a MBO attribute that binds to a synonym domain. The script cannot modify it.
var_previous Boolean The previous value of the MBO attribute, that is, the value just before the attribute value got changed. Attribute launch points – applicable only for the attribute that generated the event. The script cannot modify it.
var_initial Boolean The initial value of the MBO attribute, that is, the value assigned to that attribute when the MBO was initialized. All launch points. The script cannot modify it.
var_modified Boolean Indicates whether the MBO attribute to which the variable var binds has been modified or not. All launch points. The script cannot modify it.