This article opens Part 7, about the other script types. We checked IBM’s pages against the behaviour of Manage in the MAS 9.2 series, and we checked the class and method names of IBM’s samples on our test system. Where the pages and Manage disagree, this page follows Manage.
Action scripts#
The action behind the launch point#
An action launch point needs an action, the record that the Actions application manages. When you save a new action launch point, Manage creates that action for you:
- Its name is the launch point name, unless you enter another one.
- Its type is custom class, pointing at the script framework, with the script name, the launch point name and the action name as its parameter.
- Its object is the launch point’s object, if it has one. An action launch point does not need an object.
IBM Docs suggests creating the action later in the Actions application. For a new name, there is nothing to create: the save already did it. An existing action that you enter by name works only if it already calls the script framework with that parameter.
Two more rules:
- Attach the action yourself. The save creates the action and nothing else. Add it to the workflow, the escalation or the button.
- Leave the name alone. The action name is stored twice: as the action’s key and in its
parameter, which the script receives as
action. A rename that changes only one of them leaves the two out of step.
How workflows and escalations run it#
Workflows and escalations both run the action, and the action runs the script. An escalation adds a few steps of its own:
The save at the end matters. The script changes the record and its related records, and the escalation saves them. The script calls no save.
What the script gets#
| Variable | Holds |
|---|---|
mbo, scriptHome | the record the action runs on |
scriptName, launchPoint, action | the names from the action’s parameter |
params | the whole parameter list |
wfinstance | the workflow instance; only when a workflow started the action |
Declared variables work through bindings. An IN variable can follow a relationship path such as
assetmeterip.lastreading. An OUT variable is written back on the same path after the run, and only
if the script changed it. A launch point without an object allows only literal, system property and
maxvar bindings.
New records from an action#
A binding never adds a record. For a new related record, such as a work log, use the record’s relationships:
# an action on a service request
logs = mbo.getMboSet("WORKLOG")
log = logs.add()
log.setValue("logtype", "WORK")
log.setValue("description", "Assigned by script")The new work log joins the record’s transaction, and the escalation’s save writes it. Article 15 explains why that needs no save call.
Condition scripts#
A condition launch point answers a question with evalresult. Two parts of Manage can ask it: a
workflow condition node, and the Conditional Expression Manager.
The rule for evalresult#
Set evalresult to True or False on every path. It starts as None, and Manage has no
default of false. A condition that leaves it None fails with a NullPointerException, and a workflow
reports that as an error of the condition’s custom class.
evalresult = (status == "DECOMMISSIONED")status is an IN variable bound to STATUS. A condition launch point accepts only IN variables: a
script with an OUT or INOUT variable cannot be saved on one.
IBM’s sample sets evalresult = true in one branch and nothing in the other. true is no Python
name, so the first branch fails with a NameError, and the second leaves None.
The script runs every time the condition is evaluated. IBM Docs says it runs when the condition is
satisfied; its evalresult is what decides that.
In a workflow condition node#
| Field | Value |
|---|---|
| Node title | SCRIPTNAME:LAUNCHPOINTNAME |
| Condition type | custom |
| Custom class | com.ibm.tivoli.maximo.script.ScriptCustomCondition |
The title is read in upper case and split at the colon. IBM’s pages note that the title is short, so keep both names short. With a single launch point, the script name alone is enough. That count includes launch points of every type: a script with two launch points fails as ambiguous.
IBM Docs names the class com.ibm.tivoli.maximo.script.CustomCondition and puts it in the Expression
field. That class does not exist; on our test system it was missing. And when a custom class is set,
the workflow ignores the expression. The scripting guide has both right.
One limit: on a workflow assignment, as opposed to a condition node, the script condition answers false and runs no script.
In the Conditional Expression Manager#
A condition there takes the same class, with SCRIPTNAME:LAUNCHPOINTNAME or SCRIPTNAME as its
expression. Two differences from workflow:
- No name check. A wrong script name fails with a NullPointerException.
- No ambiguity check. With several launch points, the first one is used.
IBM Docs says that the launch point names the condition. The link runs the other way: the condition’s expression names the script. The condition field of a launch point is a filter, evaluated on the record before every run.
What IBM’s pages get wrong here#
| Topic | IBM’s pages | What Manage does |
|---|---|---|
| The condition sample | evalresult = true in one branch | true fails, and the other branch leaves None; set True or False on every path |
| The condition class (IBM Docs) | ...script.CustomCondition in the Expression field | the class is ScriptCustomCondition, in the custom class field |
| The launch point’s condition (IBM Docs) | names the expression manager condition | a filter evaluated before every run |
| Creating the action (IBM Docs) | create it later in Actions | the launch point save creates it |
| The service request example | ready to paste | the indentation and a binding with a space break it; one table names the variable differently |
Article 33 of this series collects the corrections that matter most.
What comes next#
Article 26 covers cron task and async job scripts.
IBM’s own pages are the reference to keep next to this series:
- Automation scripts in the IBM Maximo Manage documentation.
- All about Maximo scripting, IBM’s scripting guide on GitHub.
The complete list of corrections, with the evidence for each one, is in our member area. Members get access on request, so get in touch if you want it. If you want help with the scripts in your own Manage, our services page shows how we work.
IBM and Maximo are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide.
