If you need to handle workflows (start, stop, route, etc.) from an automation script you can use the following two Maximo API classes: WorkFlowService and WFInstance. Here are few examples. The WorkFlowService.initiateWorkflow metod can be used to start a workflow: To stop an active workflow you can use WFInstance.stopWorkflow method: To route a workflow I […]
Accessing UI methods from automation scripts
In Maximo 7.6.1.1 IBM has greatly improved the service implicit variable to provide a lot of useful methods to interact with the user interface. Two good examples are: For a full reference of the service methods refer to this page. There is very important method that can be used to get a reference to the […]
Scripting Best Practices for Performance
This post is a copy of a PDF file published by IBM. I’m republishing it here to make it more accessible. Scripting allows users to extend maximo business logic using Python/JS or for that matter any other JSR 223 compliant scripting language. All the script code gets compiled to Java bytecode and are cached as […]
Set long description from automation script
Today I have discovered a strange behavior when setting long descriptions from an automation script. You know that almost every DESCRIPTION field in Maximo has a corresponding “Long Description” field that is a CLOB attribute that can hold big amounts of text. This is driven by the “Long Description Owner” checkbox in Database Configuration. When […]
Display custom message from automation script
There is a well known technique to display a custom error message from an automation script. It requires to create the custom message in the Messages dialog of Database Configuration application and then to trigger the display of it throwing an exception by setting errorgroup/errorkey or using the service.error method. This technique is well described […]
Script to check if current user is in a Security Group
A typical business case is to prevent editing of some specific fields to a set of organizational roles in Maximo. This is typically achieved by implementing attribute data restriction or conditional UI. However, if you need more control over what field should be readonly and when, you can use an automation script on the INIT […]
Maximo bulk update from List view
In some cases Maximo allows to perform bulk updates using actions on the List View. For example, you can set the timezone of multiple assets by selecting the Associate Time Zone on the List View of the Assets application and then a dialog will appear to perform a massive update on all the selected records. […]
Setting multiple fields as readonly with script
Sometimes you may need to allow some users to update only few fields. This may be hard to achieve using conditional UI and conditional expressions. In the following snippet I’m setting all fields as readonly except DESCRIPTION and STATUS if the current user is in MANSUP security group. Attach the script to the Initialize event […]
Custom REST service with Automation Script
The REST APIs have a tight integration with the automation scripts. Automation scripts can be used to develop custom APIs. The following example call describes how automation scripts interact with REST APIs. You can also use automation scripts for implementing custom queries and custom actions. JavaScript language is always the preferred choice for integration scripts […]
Why I hate automation script variables binding
There are two approaches when dealing with Maximo automation scripts input and output variables. Using launch point variables – This method is described in the product’s knowledge center and allows to get/set values from/to the database specifying how to bind the script variables to specific database fields. Using getter/setter methods – This approach uses Maximo […]