Maximo Scripting – Warnings and Errors

This post is an excerpt from the Maximo 76 Scripting Features guide.

Maximo errors in 7.5 version used to get done by setting errorgroup, errorkey and params variables (full example here).

woPriority = mbo.getInt("WOPRIORITY")
if woPriority > 50:
    # Raise an error using a message
    errorgroup = "workorder"
    errorkey = "invalidPrio"

Setting those did not stop the execution, as the execution will continue till the end of that script and then it will check the flags and throw the error. Often this may not be the expected behavior. To fix this issue, in 7.6 the global “service” variable can be used to throw errors and warnings.

service.error("po", "novendor") 

Warning message

Showing a warning message can be done fairly easily with automation scripts. Say we want to show a warning to the users when they save a PO with no lines.
To do this, first we need to create a warning message from the messages dialog in the db config application. Say we name it “nolines” under the message group “po”.

We create an Object Launch Point – Save event on Add and Update. The code below (py) validates the POLINE count and uses the “service” global variable to show the warning.

if mbo.getMboSet("POLINE").count()==0 and interactive:
    service.setWarning("po", "nolines", None)
Maximo Scripting – Warnings and Errors

4 thoughts on “Maximo Scripting – Warnings and Errors

  1. How I can get the reply from such dialog? Ie, “Check your data before save ” Yes or Not

  2. Is it possible to show a warning/info message when we click on Submit button. There is no if condition, just wanted to display a custom message once record is submitted.

  3. How can I prevent an antomatic (vanilla) warning message from being displayed?

Leave a Reply to Aditi Cancel reply

Your email address will not be published. Required fields are marked *

Scroll to top