Automation scripts are the way most Manage customizations are written today. A script needs no Java build, no deployment of a customization archive and no restart. You write it in the Automation Scripts application, save it, and it is active on every server of the installation.
This is the first article of our series on automation scripts. It gives you the model that every later article builds on. We checked IBM’s two documents about scripts, the IBM Docs pages and the scripting guide on GitHub, against the behaviour of Manage in the MAS 9.2 series. Where the two disagree, this page follows Manage and says so.
A script has three parts#
Every script is built from the same three parts.
- The script holds the source code and its language. Manage stores it in the database, so it moves with the database.
- The launch point ties the script to a moment: an event on a record, a change to a field, an action, or a condition.
- The variables bind data to the script. A variable brings a value in, sends a value out, or does both.
| Part | What it holds | Object in Manage |
|---|---|---|
| Script | name, language, source code, the active flag | AUTOSCRIPT |
| Launch point | the type, the object or attribute, the event, an optional condition | SCRIPTLAUNCHPOINT |
| Variables | the binding: a field, a system property, a MAXVAR or a fixed value | AUTOSCRIPTVARS, LAUNCHPOINTVARS |
Here is a script that came with our 9.2 test system, WXOAISUMMARY, on the Launch Points tab of the Automation Scripts application. One script, three object launch points: one on SR, one on INCIDENT and one on WORKLOG.

One script can serve several launch points. A script can also exist with no launch point at all. Then other scripts call it as a library, or a cron task runs it.
Variables are optional. Next to the variables you declare, Manage gives every script a set of
implicit variables. The most used ones are mbo (the record the script works on), service (a
helper object with methods for errors, logging and calls to other scripts), user and app.
Article 4 of this series lists them all, launch point by launch point.
Four kinds of launch point#
Manage knows four kinds of launch point.
- Object: an event on a record, such as add, update, delete or save.
- Attribute: an event on one field, such as a new value or a lookup.
- Action: a step that a workflow, an escalation or a button calls.
- Custom condition: a yes or no answer for a workflow or for the user interface.
The IBM Docs overview speaks of five launch point types, each with its own wizard. The fifth wizard is for integration scripts. It names the script after the integration point and creates no launch point, so Manage knows only the four.
Two engines ship with Manage#
The language of a script decides which engine runs it. Manage ships two engines.
- Jython, a Python 2.7 for Java. It answers to the language names
jythonandpython. - Nashorn, a JavaScript engine. It answers to
javascript,js,nashornandecmascript.
The scripting guide says that Nashorn comes with the Java runtime. That was true for older Java releases, and the JDK has had no Nashorn since Java 15. Manage in the 9.2 series runs on a much later Java, so it carries its own copy of Nashorn. Both IBM documents also name Jython 2.7.2, and the 9.2 series ships a later release of the 2.7 line. Article 2 of this series compares the two languages.
What happens when you save a script#
A save does more than write a row. Manage checks the code, stores it, and loads it into a cache of compiled scripts.
Three things follow from this path.
- A compile error blocks the save. You see the error at once, and the old version keeps running.
- The save waits for the cache. On the server that saved, the script is loaded in the same request, so it is active as soon as the save returns. The other servers reload it a little later.
- The cache only knows what went through Manage. A change made with SQL directly in the database reaches the cache at the next reload, for example at the next server start.
The scripting guide puts the steps in a different order: compile, cache, then store. The IBM Docs page has the order of the diagram, and so does Manage.
One script can pass the save and still never run#
The check at save and the load into the cache are two separate compiles. Usually both give the same result. One option makes them differ: Allow Invoking Script Functions. A script with this option is run once when it is loaded, so that other scripts can call its functions later. If that first run fails, Manage leaves the script out of the cache. It writes one line at ERROR level to the log, with the text “Error in compiling script - skipping this script”, and every launch point of the script is skipped.
The user sees no error, and the script simply does nothing. So after you save a script with this option, look in the log for that line.
What happens when the script runs#
The launch point decides when a script runs. For an object or an attribute launch point, Manage registers a listener when it loads the script. When the event happens, the listener starts the run.
The compiled code in the cache is used again for every run. Each run gets its own fresh set of variables, so nothing carries over from one run to the next.
Values go in before the run and come back after it#
This is the part of the model that surprises people most. Manage copies every variable value into the script before the script starts. It copies the INOUT and OUT values back to the record after the script has ended, and only the values that changed.
So during the script, the record still holds the old value. Suppose a script sets an OUT variable
that is bound to the field DESCRIPTION, and then reads mbo.getString("DESCRIPTION"). It gets the
old description, because the new one is written after the script ends. Read the variable instead, or
set the field on mbo directly when the rest of the script needs the new value.
| Binding | Direction | Written back? |
|---|---|---|
| A field of the record | IN, INOUT or OUT | INOUT and OUT, after the run, when the value changed |
| A system property | always IN | never |
| A MAXVAR | always IN | never |
| A fixed value | IN | never |
When the script fails#
Two kinds of error reach the user in two different ways.
- An error the script raises on purpose, for example with
service.error(...), reaches the user with its own message. - Any other error, such as a typo in a name or a failed call, reaches the user as a general script error. The details go to the log at ERROR level.
The run time of each script is also written to the log, but only when the logger of that script is set to DEBUG. Both IBM documents say that the time is always written. At the default level you find nothing.
Switching a script off#
You can deactivate one launch point of a script, or the whole script. For a launch point, the effect depends on its kind.
| Launch point | What happens after you deactivate the launch point |
|---|---|
| Object | Manage no longer calls the script. |
| Attribute | Manage no longer calls the script. |
| Action | The workflow, escalation or button still calls it, and the call fails with an error. |
| Custom condition | The workflow or the user interface still asks it, and the call fails with an error. |
Both IBM documents say that Maximo does not run a deactivated script or launch point. That is true for object and attribute launch points, which simply lose their listener. An action or a condition is called from a workflow, an escalation or the user interface, and that call still happens. So when you switch off an action script, also take it out of the workflow, the escalation or the button that calls it.
Deactivating the whole script works another way. Every launch point stays registered, and each run ends at once with a line at INFO level in the log. A custom condition then gets no answer, and that also ends in an error.
The status of a script, Draft or Active, has no effect on runs. A Draft script runs exactly like an Active one. Only the active flag decides.
What IBM’s documents get wrong here#
This first part of IBM’s material is mostly right. Four statements are wrong for the 9.2 series:
- Nashorn comes with the Java runtime. Manage ships its own copy.
- The run time of a script is always written to the log. It is written only at DEBUG.
- A deactivated launch point is never called. Action and condition launch points are still called, and the call fails.
- There are five launch point types. There are four, and the fifth wizard creates none.
Article 33 of this series collects the corrections that matter most, across all of IBM’s material on scripts.
What comes next#
The next two articles stay with the basics. Article 2 compares Jython and JavaScript in the 9.2 series, and article 3 shows how scripts, launch points and variables fit together in practice.
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.
