Skip to main contentCarbon Design System

OBJECTNAME.NEW Script

This is a special type of automation script without a launch point. The name of the script must be in the format OBJECTNAME.NEW. For example, if you wanted a script on PO it should be called PO.NEW. This means you can only have one .NEW script for an object. It also means that if an object is based on a view, for example WORKORDER and WOACTIVITY, that you would need to create it for each object if you wanted the logic to evaluate for both.

The purpose of this type of script is to use default values immediately when a record is being created. Typically, you would use this when you cannot perform the default inside of Database Configuration. For example, when you need to perform some sort of conditional logic, default to this value when the site is BEDFORD, or need to retrieve information, such as from the header record. This was typically done in the Object or Attribute Initialize events prior to this being added. Since the Initialize events occur more often then .NEW, which can only fire once for a given record, it is better to utilize .NEW for default values.

Example Script

owner=mbo.getOwner()
if owner and owner.getName()=="PO":
mbo.setValue("CUSTOMFIELD",owner.getString("CUSTOMFIELD"))