One of the analogies I've used over the years is that out of the box Maximo is a giant lump of clay - it's fun to play with in its raw form, but needs to be skillfully molded to be useful. One of these molding steps is to put your organization's business processes into Maximo. Maximo has multiple ways to enforce business rules with tools like Data Restrictions on a Security Group, conditions on a status domain, and Escalations.1 Each of these tools are great ways to enforce your organization's business processes inside Maximo, but they rarely offer context about when they are being enforced. One way to give your Maximo users context of your business processes is to use an Automation Script. In this use case I want the Automation Script to pop up a dialog box to give context about what's happening with a record and guide the user on what choices they really have available to them.
There are 3 parts to setting up an Automation Script with an alert dialog box in Maximo:
- Identifying the condition the script should be triggered.
- Creating a custom error message.
- Creating the automation script.
Conditions to trigger automation script
This is the foundation of Automation Script, but none of it actually happens in Maximo. The method that works for me is to create a single paragraph that describes everything that should happen and all the fields that would be involved.
When a Maximo user sets a purchase requisition into APPR status (PR.STATUS), and the total cost (PR.TOTALCOST) is less than $100.00, Maximo should show a pop-up dialog box warning the user about the record is less than the current soft cost standard of $100.00.
This completely describes 1) the fields I need to use as part of the script, 2) gives the conditions when the script should fire off, and 3) what outcome should occur when the script is triggered.
Creating custom message
The key part of this process is the message that will be presented to the Maximo user. We want the message dialog box to pop up and cause the Maximo user to acknowledge the message, but not restrict the user from approving the PR.2 When setting up this message, the Message ID Suffix
is set to WARN. This allows the message to pop up, but does not restrict the action a Maximo user is being alerted to.
- Message Group: Set this to the object/table the script will be run against. In this case
PR
. - Message Key: This is the tag the message will use to be called up in the Automation Script. This is user defined, so choice something connected to the message.
- Display Message: Leave the default
MSGBOX
. - Message ID Prefix: Use
BMXZZ
, this is the standard in Maximo for use generated messages. - Message ID Suffix: This is how we define this is a warning message. It also triggers the icon that is displayed in the pop-up dialog box.
- Message ID: With the previous choices, Maximo will generate an ID number.
- Display ID: Check box on whether or not to include the full BMXZZ message ID number. I left this off in this example.
- Value: This is the actual message that will be displayed in the pop-up dialog box.
- Buttons: Allows you to select what buttons will be displayed in the pop-up dialog box.
Here's what the complete message looks like:
One of the key items used in the message is the variable {0}
that allows the message to pick up a passed parameter from the automation script. As shown later on, we can set the parameter value within the automation script.
Creating the automation script
In the first part we laid out how the script should work and now we're putting the concept of the script into Maximo. Since we deciced that the script should only fire when the status of the purchase request is set to APPR
, the script needs to be set against an Attribute Launch Point.
In this case we want to set the attribute as the PR.STATUS field. Maximo will open the automation script dialog box after clicking Create > Script with Attribute Launch Point. You will need to add values to all the required fields. As we laid out in the first step, the script should be triggered on the PR.STATUS field, so that's the launch point for the script.
Next we setup the variables that will be used in the script:
With both variables created, step 2 in the script creation is complete:
Last step is to add the script logic:
Click Create
to create the Automation Script and set it to Active and run.
The actual script is listed below:
from psdi.mbo import MboConstants
from psdi.server import MXServer
if MXServer.getMXServer().getMaximoDD().getTranslator().toInternalString("POSTATUS",vStatus, mbo) == 'APPR':
if vTotalCost < 100.00:
warngroup = "PO"
warnkey = "POValueWarn"
warnparams = ["100.00"]
In our warning message, we had the variable {0}
included as part of the text. Maximo uses that as a way to pass parameter values from one part of the application to the message. In our case, the parameter as created as part of the automation script. When the script gets triggered the script will trigger the warning dialog box POValueWarn
to pop up. The script also creates the parameter value of 100.00
that will get get passed to the dialog box.
Testing the Automation Script
Once the script has been created, it will automatically become active and run against Maximo records. The business logic is that a warning message should pop up when a Maximo user tries to set a PR records to APPR status. The example below is setup to trigger the automation script.
So when a Maximo user attempts to approve the PR, they will see this message:
Since the goal was not to restrict the Maximo user's choice, the PR is allowed to be set to APPR
and be approved.
Now when a Maximo user approves a PR that is less than $100.00, Maximo will give the user a gentle reminder about our current business rules.