IBM Support

How to show an error message by automation script?

Technical Blog Post


Abstract

How to show an error message by automation script?

Body

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
Message Key:mykey1
Display Method: MSGBOX
Message ID Prefix:BMXZZ
Message ID Suffix:E
Value:Please correct value of ESTDUE
Display ID: Tick it
Buttons: Tick OK

image

 

 

 

 

 

 

 

 

 

 

 

 

 

 

# 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:

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

image

 

 

 

 

 

 

 

 

 

 

 

2. Next step
- Script: ESTDUR
- Script Language: python
- New Variable:
Variable: ESTDUR
Variable Type: INOUT
Binding Type: Attribute
Launch Point Attribute: ESTDUR

image

 

 

 

 

 

 

 

 

 

 

 

3. Next Step:
due = mbo.getMboValue("ESTDUR").getString()

if (due == '0:00'):
   errorgroup = "mygroup"
   errorkey = "mykey1"

image

 

 

 

 

 

 

 

 

 

 

# If you are using warning message, the code for warning message will be:

  warngroup = "mygroup"
  warnkey = "mykey1"

Please refer this blog for details:

HOWTO: Throwing a Warning Dialog in an Automation Script

 

 

 

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".

image

 

[{"Business Unit":{"code":"BU005","label":"IoT"}, "Product":{"code":"SSLKT6","label":"Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm11129593