Wednesday, 24 July 2019

Maximo Automation Script setting values while Initializing

There are times where we need to set the value when the object is invoked rather that setting the values during the save method. This can be achieved in Maximo automation scripts.

Step 1: Create an Object Launch Point with JavaScript.
Step 2: Make sure to check the Initialize? check box is checked. And all other check box are unchecked.
Step 3: Below is the sample code for setting the "Inspection Required" and "Adding Spare Parts" check box to always be checked when the item is created.

importPackage(Packages.psdi.mbo);
if(mbo.getString("ITEMSETID")=="ITEMSET1"){
    if(mbo.toBeAdded()==true){
        mbo.setValue("INSPECTIONREQUIRED", 1);
        mbo.setValue("SPAREPARTAUTOADD", 1);
    }
}