To import classes properly in Nashorn you can do the following, where you import the
MXServer
class and then in this case get the LABOR MboSet.
var MXServer = Java.type("psdi.server.MXServer")
var set = MXServer.getMXServer().getMboSet("LABOR", MXServer.getMXServer().getSystemUserInfo());
You may also run into issues with calling overloaded methods such as mbo.setValue("attribute","value")
since the value
parameter may be of many different types. To avoid this you can specify the specific method you want to call by specifying the types as shown below.
mbo["setValue(String, String)"]("ATTRIBUTENAME", "string value")
mbo["setValue(String, int)"]("ATTRIBUTENAME", "int value")
------------------------------
Jason VenHuizen
------------------------------
Original Message:
Sent: Fri May 29, 2020 08:54 AM
From: Robert Goff
Subject: Maximo 7.6.1 - Automation script. Errors with parameters doesnt work (javascript)
I haven't had a problem using jython lists as before instead of java.ArrayList; the first thing I'd try is adding double quotes around the values in your list, i.e. ["value1", "value2"]
If that doesn't help, here's an article about using the mozilla-compatible version of Nashorn:
https://a3jgroup.com/automation-scripts-compatibility-with-maximo-7-6-1/
------------------------------
Robert Goff
Original Message:
Sent: Thu May 28, 2020 09:10 AM
From: Arturo Carmona Lozano
Subject: Maximo 7.6.1 - Automation script. Errors with parameters doesnt work (javascript)
Hello everyone,
We recently upgraded to Maximo 7.6.1 from Maximo 7.6.0 and there is a problem with our automations scripts that show errors with parameters, they are not taking the values as parameters as they did with Maximo version 7.6.0.
The syntax is as follows:
errorgroup = "workorder";
errorkey = "newerror";
params = [value1, value2];
Message in the dabatase configuration is as follows:
"Error message example with value 1 {0} and value 2 {1}".
Since the upgrade to Maximo 7.6.1, every error message with parameter is just showing the message without replacing the values. Code is written in javascript.
Any advice will be helpful.
PD: English is not my main language, sorry for the grammar.
------------------------------
Arturo Carmona Lozano
------------------------------
#Maximo
#AssetandFacilitiesManagement