Set values in fields by using the overrideValues(ctx) function
The overrideValues(ctx) function sets the value of a field in the XML message.
The ctx.overrideCol() API sets the value of the field in the XML message. For example, the following script sets the value of the site ID to ABC:
def overrideValues(ctx):
if ctx.getMboName()=='ASSET':
ctx.overrideCol("SITEID","ABC")
In the following example script, if the description field of a purchase order is empty, the description field is set to the purchase order number:
def overrideValues(ctx):
if ctx.getMboName()==’PO’:
mbo = ctx.getMbo()
if mbo.isNull("description"):
ctx.overrideCol("DESCRIPTION",mbo.getString("ponum"))