↓ Skip to main content
An ink and watercolour drawing of a sheet of paper on a workbench with rows of wavy pen lines. Five rows are struck through in orange, with a short teal wavy line written in above each, and an orange fountain pen lies beside the sheet.

Where IBM's Script Documentation Is Wrong

Maximo Automation Scripts - This article is part of a series.
Part 33: This Article
IBM’s two documents on automation scripts are the best starting point there is, and many of their statements are right. More than 180 are wrong, or right only under a condition they leave out. This page collects the 25 that matter most: each breaks a script, or changes what it does without a warning.

This article opens Part 9, the reference. Every correction below was checked against the behaviour of Manage in the MAS 9.2 series, many of them on our test system as well, and each one links to the article of this series that explains it.

How we chose them
#

A correction made this list when it has one of two effects:

  • The script fails. A method that does not exist, a variable with another name, a sample that does not compile.
  • The script runs and does the wrong thing. A check that never fires, a value that never arrives, a write that disappears.

Corrections of wording, history or screenshots did not make the list. The complete list, with the evidence for each statement, is in our member area.

Variables and the service object
#

IBM’s documents sayWhat Manage doesArticle
userInfo exists in every launch pointobject, attribute, action and condition launch points do not get it; use mbo.getUserInfo()4
srcKeys names the fields of the current recordswapped: targetKeys names the current record’s fields4
the error variable is errorgrpit is errorgroup; errorgrp raises nothing12
yncuserinput takes group, key and parametersit takes no arguments; the documented call fails12
check for a user session with interactionthe variable is interactive12
service.isLoggingEnabled() checks the log levelthe method does not exist in the 9.2 series14
set the autoscript logger to see a script’s outputthe script’s own Log Level field decides, and overrides the logger14
skip costly init work with UIContext.isFromListTab()that class call fails; ask UIContext.getCurrentContext()17

Integration
#

IBM’s documents sayWhat Manage doesArticle
import Namespace and Element from org.jdomManage 9.2 has org.jdom2; the old import fails18
set an integer with irData.setCurrentDataAsIntthe method does not exist; use setCurrentData18
ctx.skipTxn() skips the inbound messageit skips the current noun; the others load19
ctx.getMsgType() gives the message typeit returns None unless the script set it19
ctx.processAsAtEnd() adds at the endthe method is processAsAddAtEnd()19
the endpoint’s SCRIPT property takes the script nameit must be in upper case, or the call fails20
the HTTP exit sets the URL with req.setUrlthe method is setURL20
the JMS exit’s responseError handles errorsit is never called in the 9.2 series20
the best-practice event filter filters by statusit sets evalresult = True on every path and drops every event21

REST, workflow and the other types
#

IBM’s documents sayWhat Manage doesArticle
headers in responseHeaders go back to the calleronly content-type is used; the rest is dropped22
call the SENDCOMM action with a POSTa plain POST leaves mbo as None; add x-method-override: PATCH24
the condition sample sets evalresult = truetrue fails in Python, and the other branch leaves None25
the workflow condition class is ...script.CustomConditionthe class is ScriptCustomCondition25
an async job script gets wherethe variable is whereclause26
an MXERR script mails with sendEmailthe method is sendEMail27
an attachment store’s deleteAttachment reads the name like createAttachment, and a renamed file gets the topLevelPaths prefix from the scriptthe name is None on delete, so read urlname from the record; Manage adds the prefix itself, so the script doubles it28
warning BMXAA10022W flags several scripts on one eventthe check never fires31
Where the 25 corrections sit Where the 25 corrections sit
Where the 25 corrections sit

Reading IBM’s pages with this list
#

Three habits help with every page, beyond these 25:

  • Test the sample before you copy it. Several samples do not compile as printed: wrong indentation, = in a test, true in Python. The save refuses them.
  • Trust names last. Most of the failures above are a name: a variable, a method, a class or a property that differs by one letter or one case.
  • Ask what happens when nothing happens. The worst corrections are silent: a check that never fires, a header that is dropped, a variable that stays empty.

What comes next
#

Article 34 covers what the script engine does that nobody documented.

IBM’s own pages are the reference to keep next to this series:

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.

Maximo Automation Scripts - This article is part of a series.
Part 33: This Article