There is a well known technique to display a custom error message from an automation script. It requires to create the custom message in the Messages dialog of Database Configuration application and then to trigger the display of it throwing an exception by setting errorgroup/errorkey or using the service.error method. This technique is well described in several blog post so I’m not going to repeat it: Maximo Scripting, My Geek Daddy.
Having defined a message mxdev.msgid, it just requires one line of code to display it from an automation script.
service.error("mxdev", "msgid", [])
However, there is one drawback of this approach. It uses an exception to display the message. This means that you will have long stack traces in your Maximo system logs that may make them hard to read.
A better approach is to use the WebClientSession.showMessageBox method. The current WebClientSession reference can be retrieved in the latest versions of Maximo using the technique described in this discussion thread.
The automation script code will be something like this:
wcs = service.webclientsession()
wcs.showMessageBox("mxdev", "msgid", [])
Don’t forget to create the custom message in Database Configuration – Message dialog.
The showMessageBox is nice! Thank you!