Add business objects and change values in fields by using the afterMboData(ctx) function

The afterMboData(ctx) function implements custom logic to create an extra related Maximo® business object for inclusion in the transaction or change data in a Maximo business object. The function is available after the business object is created and the values are set in the Maximo business object by the integration framework.

When columns in the object structure are restricted, you can use the afterMboData(ctx) function to provide the logic to set those columns instead of having the integration framework set the values.

In the following example, an asset is created with the description field set to a concatenation of the EXTERNALREFID field and the description field that is passed from the object structure:

importPackage(Packages.psdi.server);
importPackage(Packages.psdi.mbo);
function afterMboData(ctx)
{
     var mbo = ctx.getMbo();
     var struc = ctx.getData();
     mbo.setValue("description", "FROM: "+struc.getCurrentData("EXTERNALREFID")+ "   DESC: "+struc.getCurrentData("DESCRIPTION"));
}