Automation scripts
Automation scripts are small, targeted pieces of code that can extend the product. An automation script consists of a launch point, variables with corresponding binding values, and the source code. You use the Automation Scripts application to create the components of an automation script. You create scripts and launch points or you create a launch point and associate the launch point with an existing script.
An automation script is interpreted and run at run time by the IBM® Maximo® Manage scripting framework when a target event happens. The scripting framework can handle various events, including attribute modifications, object modifications, and callbacks. These events and callbacks help you target the correct extension points for your custom feature. The code and the associated configuration are stored in the Maximo database, and the compiled scripts are cached at run time.
You use automation scripts to implement object rules, attribute validations, workflow or escalation actions, and workflow and security condition logic for applications. Automation scripts can reduce the time that you spend on automating tasks because you do not need to recompile files or restart the server.
You can also create library scripts, which are reusable pieces of programming language that automation scripts can invoke from the body their code. Library scripts must be hosted on the same system.
You can edit a script in an editor of your choice. Every script has an associated attribute that specifies a script language. This attribute determines the appropriate script engine to process the script.
The value list for available script languages comes from script engine inputs in the class path. Most engines support script compilation, which eventually converts the script to an executable bytecode for the Java™ virtual machine.
Maximo Manage supports JavaScript and Jython compiled scripts. When you commit the design process, the framework compiles and caches the script in the background. This process creates scripts that are ready to run.
Prerequisite skills
- Scripting language syntax and operations
- Product configurations such as workflow processes, escalations, and actions
- Application data models and relationships
You use the same menu items for creating scripts and launch points as you do for creating a launch point to associate with an existing script. For example, you use the Create > Script with Object launch point action to create a script and an object launch point, or to associate an object launch point with an existing script.
In some automations, you must use the documented MBO APIs to automate a routine task. For example, when you automate a task that involves creating a record, you must use the documented MBO APIs for the record creation part of the automation.
Components of automation scripts
- Launch points
- A launch point defines the execution context for a script, for example when a business object is updated or a value is entered into a field. Five types of launch point are supported and the Automation Scripts application provides a separate wizard application for creating each type of launch point.
- Variables and binding values
- You can specify the variables that determine how information is passed into or received from a script in the wizard applications. Variables are not mandatory, but when you use variables it simplifies the amount of code to be written and is easier to reuse the code.
- Source code
- You can write source code in an external application and import it into the Automation Scripts
application. Alternatively, you can enter code directly into the Source Code
field in the wizard applications. The source code must be written in the languages that are
supported by the following script engines:
- Nashorn JS
- Jython, version 2.7.2