Skip to main contentCarbon Design System

Errors and warnings in scripts

Errors and warnings in scripts

Errors in Maximo 7.5 used to get done by setting the variables, errorgroup, errorkey and params. Setting these variables did not stop the execution which would continue till the end of that script, check the flags, and throw the error. Often this may not be the expected behavior. To fix this issue, in 7.6, the utility methods has been added to the global “service” variable to throw errors and warnings. The following example should replace what you have been doing with errorkey and errorgroups in Maximo 7.5:

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

Showing a warning message can be done fairly easily with automation scripts. For example, if you want to show a warning to the users when they save a PO with no lines:

  1. Create a warning message from the messages dialog in the db config application.
  2. You can name it “nolines” under the message group “po”.
  3. Create an Object Launch Point - Save event on Add and Update.

The following code (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)