Skip processing of business objects by using the skipMbo(ctx) function
The skipMbo(ctx) function filters data from the XML message that is built during the serialization process. The skipMbo(ctx) function can filter a Maximo® business object, continue processing the message after a business object is skipped, or terminate the processing of the message at the point of execution.
ctx.skipMbo() API
The ctx.skipMbo() API filters out the processing of any Maximo business objects in the XML message.
For example, the following script executes on the ctx.skipMbo() API, and filters out all purchase order lines and their related purchase order cost data for the 1234 purchase order line.
def skipMbo(ctx):
if ctx.getMboName()==’POLINE’ and ctx.getMbo().getString("itemnum")=="1234":
ctx.skipMbo()
If you use the ctx.skipMbo() API on the root or primary object in the object structure, any business object that meets the criteria in the IF statement is filtered from the XML message.
ctx.process() API
The ctx.process() API continues processing lines that are not filtered out by the ctx.skipMbo() API, for example:
def skipMbo(ctx):
if ctx.getMboName()==’POLINE’ and ctx.getMbo().getString("itemnum")=="1234":
ctx.skipMbo()
else
ctx.process()
Executing the ctx.process() API on a row of data enables that data to be serialized. If the Java™ definition class skips that row of data, the ctx.process() API overrides the Java definition class and allows the data to be serialized.
ctx.complete() API
When the ctx.complete() API is invoked, the outbound processing of the object structure is stopped for the current instance of the business object, for instances of the child business objects, and for instances of its peer-level business objects.
For example, the PO object consists of the child objects POLINE and POTERM. The POLINE object consists of a child object POCOST. When the ctx.complete() API is invoked on the PO object, the POLINE, POTERM, and POCOST objects that are related to that PO are not processed.
In the following example script, any purchase order that has a status of complete is processed without the serialization of its purchase order line data.
def skipMbo(ctx):
if ctx.getMboName()==’PO’ and ctx.getMbo().getString("status")=="COMPLETE":
ctx.complete()
else
ctx.process()