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)
How I can get the reply from such dialog? Ie, “Check your data before save ” Yes or Not
This is the correct post: https://bportaluri.com/2019/11/maximo-scripting-yes-no-cancel-dialog.html
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.
How can I prevent an antomatic (vanilla) warning message from being displayed?