Technical Blog Post
How to show an error message by automation script?
In Maximo application, you may want to validate some attributes before save the record. If the attributes are incorrect, you would like the system to gave error message to indicate the users to fix the data before saving the record. There are many ways to achieve this function in Maximo, while today I would like to give an example by using automation script.
For example, we have a use case like this:
In Work Order Tracking application, ESTDUE is set as "0:00" by default, while we prefer user input correct value before save the record.
And how to achieve this function? You may try this way:
Step 1: Create new warning message
In System Configuration - Platform Configuration - Database Configuration, Click More Action - Messages
Click New to create a new message:
Message Group: mygroup
Display Method: MSGBOX
Message ID Prefix:BMXZZ
Message ID Suffix:E
Value:Please correct value of ESTDUE
Display ID: Tick it
Buttons: Tick OK
# Please note, you may add warning message here.
If it is a warning message, the system would not stop the user saving the record.
Step 2: Create automation script
1. Create a new Script with Object Launch Point
-Launch Point name: ESTDUR
- Object: WORKORDER
- Event: Save
- Save: Tick Add, Update and Before Save
2. Next step
- Script: ESTDUR
- Script Language: python
- New Variable:
Variable Type: INOUT
Binding Type: Attribute
Launch Point Attribute: ESTDUR
3. Next Step:
due = mbo.getMboValue("ESTDUR").getString()
if (due == '0:00'):
errorgroup = "mygroup"
errorkey = "mykey1"
# If you are using warning message, the code for warning message will be:
warngroup = "mygroup"
warnkey = "mykey1"
Please refer this blog for details:
Now, please go to work order tracking application and create a new work order. When save it, error message would occur if ESTDUE is "0:00".