Errors and warnings in scripts

You can use automation scripts to display error and warning messages.

The utility methods has been added to the global service variable to throw errors and warnings.

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

Showing warning messages can be done with automation scripts. For example, you can show a warning to users when they save a purchase order with no lines. First, create a warning message from the Messages dialog in the Database Configuration application. Name the warning message nolines and put it in the po message group. Then, in the Automation Scripts application, create a script with an object launch point. Save the event on Add and Update.

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