Change business objects or business object sets by using the afterCreateMboSet(ctx) function
The afterCreateMboSet(ctx) function processes the inbound object structure after the framework creates the Maximo® business object or business object set.
The afterCreateMboSet(ctx) function is available to operate on all business objects in the object structure. This function can change the business object or business object set that the framework created or can inject more business objects into the business object set.
The following example sets an MboSet property to note that the created location has a type of Storeroom. This logic replaces the default logic that is in the MXSTORELOC processing class.
importPackage(Packages.psdi.server);
function afterCreateMboSet(ctx)
{
var loc type = MXServer.getMXServer().getMaximoDD().getTranslator()
.toInternalString("LOCTYPE",ctx.getData().getCurrentData("TYPE"));
if (loc Type=="STOREROOM")
{
ctx.getPrimaryMboSet().setStoreroom();
}
else
{
ctx.getPrimaryMboSet().setNonStoreroom();
}
}