We found these features while working with Manage in the MAS 9.2 series, and we tested many of them on our test system. Three of them appear for the first time in this series; the others link to the article that covers them.
Bindings and variables#
1. Flag bindings. An attribute binding can read a field flag instead of the value:
STATUS@readonly, STATUS@required or STATUS@hidden gives a true or false variable. As an OUT or
INOUT variable, it also sets that flag when the script changes it. Four more forms only read:
@modified, @initial, @previous and @internal. Article 5
covers bindings and their traps.
2. Warnings through variables. A script that sets warngroup and warnkey, and optionally
warnparams, adds a warning to the record’s set after the run. It is the variable form of
service.setWarning. Pass warnparams as a list.
Article 12 shows both.
3. A plain script that answers a function call. service.invokeScript(name, function, args)
needs the function flag on the library. Without it, the call raises no error: the whole script runs,
with invokeFunction and invokeArgs as variables, and the call returns whatever the script puts
into invokeResponse. So a plain script can serve function calls, if it reads those variables.
Article 13 covers both forms.
4. A named set is a cache key. mbo.getMboSet(name, object, where) keeps the set on the record
under its name. A second call with the same name and another where clause resets that set, and its
new records are gone without an error.
Article 15 shows the trap.
Scripts Manage runs by name#
5. OBJECT.SAVE. A script with this name runs before every save of a record of that object,
with no launch point. Combined with a save launch point on the same script, it runs twice.
Article 10 lists every name of this kind.
6. OBJECT.AFTERDUPLICATE and relationship scripts. The first runs after the REST duplicate
action, with the original and the copy. A relationship whose where clause names a script lets that
script build the related set. Article 10 covers both.
System properties#
7. mxe.script.deactivateall. Set to 1, it makes every script inactive at once, on every launch
point and every call path. It is the emergency stop.
Article 29 places it among the habits of an estate.
8. mxe.script.autocleanup. Set to true, it cleans up every set that a script opened itself and
still holds in a variable at the end of the run, and logs a warning. It finds forgotten clean-ups,
and it replaces none. Article 17 covers it.
9. mxe.script.reloadperscript. By default, saving a script reloads only that script in the
cache. With the value 0, every save reloads the whole cache. The reload sits in the save of the
script and launch point records, so any save through them counts: from the application, from REST or
from an integration. A change made directly in the database reaches the cache only at the next
reload.
10. mxe.script.jsfuncwrap. Set to 1, it wraps every JavaScript source in a function when it is
loaded, so var names become local. A JavaScript library that hands its functions back through the
map then stops working. Article 13 shows the effect.
REST and integration#
11. Action script output. An object structure action can return a record or a set in
responseBody, and Manage writes it as REST JSON. Without responseBody, every OUT or INOUT literal
variable comes back as one JSON object. A literal variable allowget with the value 0 blocks GET.
Article 24 covers actions.
12. The REST request in an outbound object structure script. In an OSOUT. script,
ctx.getJsonRequest() returns the REST request when the record is written for REST. The script can
read its query parameters and headers.
Article 19 covers object structure scripts.
13. Message type shortcuts. The inbound ctx has setMsgTypeSync(), setMsgTypeCreate() and
setMsgTypeUpdate(), called in beforeProcess. They matter because getMsgType() returns None
unless the script set it. Article 19 shows why.
14. The hidden parts of the endpoint exits. The HTTP exit has a fifth function, formData(req),
for form fields. The SOAP request can ask for the response headers with fetchResponseHeaders(),
and the response returns them with getResponseHeaders(). The JMS exit is registered with the
property JMSEXIT. Article 20 covers all three
exits.
15. The full message in an MXERR script. Besides egroup, ekey and eparams, an MXERR script
gets emsg, the formatted message with the text of a wrapped error.
Article 27 covers MXERR scripts.
How we chose them#
Our full inventory holds every script-facing feature that no IBM page names. The fifteen above made this list because a developer meets them while writing or running ordinary scripts. A few others were left out on purpose, until we have checked them further.
What comes next#
Article 35 is the quick reference card for the whole series.
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 inventory of what the script engine does without documentation 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.
