I have some relatively simple code which displays a yes/no dialog in Maximo 7.6.0.9. Porting to Maximo 7.6.1.1 did not work at all despite using the compatibility option. No dialog is displayed and the debug is indicating it doesn't know what the constants for yes and no are which leads me to believe that I didn't specify the service package correctly but it is not clear to me how to make this work.
The code while working under Maximo 7.6.0.9 and WebSphere 8.5.5.4, fails under: Maximo IBM Maximo Asset Management 7.6.1.1 Build 20190514-1348 DB Build V7611-01, websphere 9.0.5.1
Here is the basic automation script:
load("nashorn:mozilla_compat.js");
importClass(Packages.psdi.mbo.MboRemote);
importClass(Packages.psdi.mbo.MboConstants);
importClass(Packages.psdi.mbo.MboSetRemote);
importClass(Packages.com.ibm.tivoli.maximo.script.ScriptService);
importClass(Packages.psdi.util.MXApplicationException);
importClass(Packages.psdi.server.MXServer);
importClass(Packages.psdi.iface.mic.InvokeChannelCache);
importClass(Packages.psdi.mbo.GLFormat);
var attTest = processAnyAttachments(mbo);
function queryuser(mbo) {
service.log(scriptName + ".JS - entering queryuser(mbo)");
service.log(scriptName + ".JS - service.YNC_NULL = " + service.YNC_NULL +
", service.YNC_NO = " + service.YNC_NO + ", service.YNC_YES = " + service.YNC_YES);
service.log(scriptName + ".JS - service = " + service);
var answer = service.yncuserinput();
if (answer == service.YNC_NULL) {
service.yncerror("slcfinance", "nopoattachments");
} else {
service.log(scriptName + ".JS - answer != service.YNC_NULL, but: " + answer);
}
if (answer == service.YNC_NO) {
service.log(scriptName + ".JS - answer == service.YNC_NO");
service.error("slcfinance", "usercancel");
} else {
service.log(scriptName + ".JS - answer != service.YNC_NO, but: " + answer);
}
service.log(scriptName + ".JS - leaving queryuser(mbo)");
}
function processAnyAttachments(mbo) {
service.log(scriptName + ".JS - entering processAnyAttachments(mbo)");
var retVal = true;
var doclinksMSR = mbo.getMboSet("DOCLINKS");
if ((doclinksMSR != null) && (!doclinksMSR.isEmpty())) {
service.log(scriptName + ".JS - some doclinks found");
} else {
service.log(scriptName + ".JS - no doclinks found");
if (interactive) {
service.log(scriptName + ".JS - invoking queruser(mbo)");
retVal = queryuser(mbo);//TBD MAKE THIS WORK
service.log(scriptName + ".JS - Done invoking queruser(mbo)");
}
}
service.log(scriptName + ".JS - leaving processAnyAttachments(mbo) - retVal = " + retVal);
return retVal;
}
I tried with the ync message of type "i" and "e" just in case it was something there with no change.
Can someone tell me how to make this work? Otherwise I"ll have to switch to jython which is a fair amount of labor. thanks
ok I'm not sure if I made a mistake or not but my output looks like this now: -- it doesn't matter if I import or don't import the serviceScript
ScriptMboEventListener Event maximo.po.update has been fired for script POBEFORESAVE launch point POBEFORESAVE
POBEFORESAVE.JS - entering processAnyAttachments(mbo)
POBEFORESAVE.JS - no doclinks found
POBEFORESAVE.JS - invoking queruser(mbo)
POBEFORESAVE.JS - entering queryuser(mbo)
POBEFORESAVE.JS - service.YNC_NULL = undefined, service.YNC_NO = undefined, service.YNC_YES = undefined
POBEFORESAVE.JS - service = com.ibm.tivoli.maximo.script.ScriptService@5db5a021
POBEFORESAVE.JS - answer != service.YNC_NULL, but: -1
POBEFORESAVE.JS - answer != service.YNC_NO, but: -1
POBEFORESAVE.JS - leaving queryuser(mbo)
POBEFORESAVE.JS - Done invoking queruser(mbo)
POBEFORESAVE.JS - leaving processAnyAttachments(mbo) - retVal = undefined
update 20300710- I think it is a bug in 7.6.1.1