Showing posts with label condition code. Show all posts
Showing posts with label condition code. Show all posts

Tuesday, 13 August 2019

Populating Condition Codes By Just Clicking Condition Code Check Box in Maximo

Recently we had a requirement to add the condition Code on clicking the Condition Code Check box in Item application.

Below is the Code that was written in JavaScript,
Launch Point Type: Attribute Launch Point
Object: Item
Attribute Name: CONDITIONENABLED

importPackage(Packages.psdi.mbo);

var conditioncode  = mbo.getBoolean("CONDITIONENABLED");
var itemconditionSet = mbo.getMboSet("ITEMCONDITION");

if(conditioncode)
{
  for(i=0;i<3;i++)
  {
    var itemcondition = itemconditionSet.addAtEnd();
    if(i == 0)
    {
      itemcondition.setValue("CONDITIONCODE","A");
    }
    else if(i == 1)
    {
      itemcondition.setValue("CONDITIONCODE","B");
    }
    else if(i == 2)
    {
      itemcondition.setValue("CONDITIONCODE","C");
    }
  }
}