Change status or status date by using the changeStatus(ctx) function

The changeStatus(ctx) function implements a status change outside the statefulMicSetIn class that is available in the integration framework. You can also use this function to set the status date with a value instead of using the system date.

For the automation script to use the changeStatus(ctx) function, the statefulMicSetin class or the class that extends the statefulMicSetin class must be registered as the processing class in the object structure. You can use this function to support a status change for five parameters. The base class supports only three parameters.

The following example sets the memo field that is related to the change status action to a string value if the NP_STATUSMEMO field does not contain a value:

importPackage(Packages.psdi.server);
importPackage(Packages.psdi.mbo);

function changeStatus(ctx)
{
     var mbo = ctx.getMbo();
     var struc = ctx.getData();
     var stat = struc.getCurrentData("STATUS");
     var memo = struc.getCurrentData("NP_STATUSMEMO");
      if(struc.isCurrentDataNull("NP_STATUSMEMO"))
     {
          memo = "Status change via Integration";
     }
      mbo.changeStatus(stat, MXServer.getMXServer().getDate(), memo, MboCon-stants.NOACCESSCHECK);
}