↓ Skip to main content
An ink and watercolour drawing of a wooden pegboard above a workbench. Seven hand tools hang in two rows, each inside its own painted outline: a hammer, a screwdriver, an adjustable wrench, pliers, a chisel, a saw and a square. One outline in the lower row is empty, and its wrench lies on the bench below.

Naming and Governing a Script Estate

Maximo Automation Scripts - This article is part of a series.
Part 29: This Article
A script estate grows one quick fix at a time, until nobody knows which scripts run on a save, or in which order. This article collects the rules that keep it under control: names that collide with nothing, a real order on one event, and the habits that make an estate listable, promotable and stoppable.

This article opens Part 8, about development practice. We checked common advice on script estates against the behaviour of Manage in the MAS 9.2 series. Where the advice and Manage disagree, this page follows Manage.

Names that collide with nothing
#

Manage acts on some script names by itself. Article 10 lists them. The one that bites in practice is OBJECT.SAVE: Manage runs a script of that name before every save of the object, with no launch point.

Popular advice names scripts after their object and event, such as ASSET.SAVE, and gives the launch point the same name. With a before save launch point on that script, it runs twice for every saved record: once by its name, and once through the launch point. Every side effect happens twice, and the run by name has no launch point variables.

So the rule from article 10 holds: use no dot in your own script names. A scheme such as ASSET_SAVE_SETPRIORITY_01 collides with nothing that Manage acts on. The one dot worth using on purpose is LIB., because a new script with that prefix gets the function flag that a function library needs.

One event, one order
#

Several scripts can hang on the same launch point event. Manage then runs them in no fixed order: the scripts of one event are kept in an unordered table. A number at the end of a name tells a reader the intended order, and Manage ignores it.

The warning that should flag such a conflict never fires. Article 31 shows why.

Two ways to get a real order on one event Two ways to get a real order on one event
Two ways to get a real order on one event

There are two ways to a real order:

  • One script per event. Put all the logic of one object event into one script, each part in its own function, and call the parts in the order you need. Larger parts can live in library scripts, as article 13 shows.
  • A group action. IBM’s support page on sequentially ordered automation scripts shows the technique: one save script runs a group action, and the group runs its member actions in the order of their sequence numbers.

Cheap checks before work
#

An object script runs on every save, from every source: the screen, an integration, a workflow, an escalation or another script. Most saves change nothing the script cares about. So check first:

if mbo.isModified("STATUS"):
    apply_status_rules(mbo)

apply_status_rules stands for your own code. An attribute launch point is the other choice, but it runs on every value set, also from imports and from other scripts. Article 17 shows that cascade.

Bindings or code
#

Some teams ban the Variables tab and read every value through the MBO API. That is a matter of taste, with a cost on both sides. Bindings give relationship paths, field flags, previous and initial values and launch point overrides, which plain code has to rebuild. They also bring their traps: values are copied in and back, an initial value is a Maximo value object, and after save writes nothing back. Article 5 covers them. Whichever a team picks, it should pick it once, for the whole estate.

Habits of a governed estate
#

The rest is practice, and Manage has little to say about it. Four habits that common advice agrees on, with the facts Manage adds:

  • An inventory. List every script with its launch points, grouped by object and event, active and inactive. The Automation Scripts application lists them, and the object structure for scripts reads them over REST.
  • A promotion path. Move scripts between systems with Migration Manager or another documented path, and keep production free of hand edits.
  • One purpose per script, written down. A short header comment with the purpose, the trigger and the owner. A reviewer six months later has nothing else.
  • A switch for emergencies. The system property mxe.script.deactivateall set to 1 makes every script inactive at once, on every launch point and every call path. Neither IBM page names it.

What popular advice gets wrong#

AdviceWhat Manage does
Name a script OBJECT.SAVE and its launch point the sameManage runs OBJECT.SAVE by name before every save; with the launch point it runs twice
A number at the end of a name sets the orderManage ignores it; scripts on one event run in no fixed order
Attribute scripts run on every keystrokethey run once per value set, from the screen and from code alike

Article 33 of this series collects the corrections that matter most.

What comes next
#

Article 30 covers testing automation scripts.

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 29: This Article