Problems with Eval Javascript in Transform Table Pattern Operation

tphillips
Tera Contributor

I am writing up a horizontal discovery pattern that is bringing back Display (monitor) information.  When I am performing the Transform Table operation, I have one field that takes the Manufacture and should return the Manufacture SysID from the core_company table.  The code below is not returning a proper SysID when I have it in the field as Eval Javascript:

var newVendor = ${displaysMonitor1[].monitorVendor1};

var mm = Packages.com.snc.cmdb.MakeAndModel.fromNames(newVendor , null);
var mfgSysID = mm.getManufacturerSysID();
ms.log("Debug ::" + newVendor+ "::" + mfgSysID);
rtrn = mfgSysID;

 

The vendors being returned are in the core_company table. I am getting no errors from the script. mm and mfgSysID are coming back undefined.

What else can I try?

 

Thanks,

Tom

10 REPLIES 10

robertgeen
Tera Guru

So I have a feeling the package probably isn't available on the mid server and eval scripts in Service Mapping run on the mid server. Do this run the step using test and then pull back the mid server logs. Any error messages with this will be in the MID server logs and your answer should be there. I would also try adding * in your first line in the [] as I can't remember off the top of my head if it's needed (you can check other eval scripts to see if they use it on there)).

Either way check the log and let me know what error message you find. Thanks.

ChrisBurks
Mega Sage

Not sure if this applies but are the "Packages.com" calls still working? 

Would this work:

 SncMakeAndModel.fromNames(newVendor, null)

instead of 

Packages.com.snc.cmdb.MakeAndModel

Reference
 https://docs.servicenow.com/bundle/london-application-development/page/script/general-scripting/concept/c_PackagesCallRemovalTool.html#ariaid-title6

I suspect this won't help because I believe this pertains to a server side script and the EVAL script is strictly on the mid server only (which doesn't have everything that the server side has). I think we need an error message to figure it out.

Robert,

Thanks for the replies.

No errors in the agent0.log, wrapper.log or logfile.txt.  Below is a snippet of agent0.log:

 

09/14/18 06:56:27 (292) Worker-Interactive:PatternDebuggerProbe Enqueuing: C:\MID_Server_DEV\agent\work\monitors\ECCSender\output_0\ecc_queue.0276b821dba0e700be8df81d0f961978.xml
09/14/18 06:56:27 (307) Worker-Interactive:PatternDebuggerProbe Worker completed: PatternDebuggerProbe source: 10.72.10.71 time: 0:00:00.312
09/14/18 06:56:27 (807) ECCSender.1 Sending ecc_queue.0276b821dba0e700be8df81d0f961978.xml
09/14/18 06:56:58 (246) Worker-Interactive:PatternDebuggerProbe Worker starting: PatternDebuggerProbe source: 10.72.10.71
09/14/18 06:56:58 (496) Worker-Interactive:PatternDebuggerProbe (69)DebuggerPatternExecutor - Starting step: [name='update cmdb_ci_display_hardware 1', functor=TransformTableClosure:TRANSFORM_TABLE:0bf384a6-4adb-408f-8ea3-f49ce06aca17]
09/14/18 06:56:58 (511) Worker-Interactive:PatternDebuggerProbe *** Script: Debug ::Samsung Electric Company::undefined
09/14/18 06:56:58 (511) Worker-Interactive:PatternDebuggerProbe *** Script: Debug ::Samsung Electric Company::undefined
09/14/18 06:56:58 (511) Worker-Interactive:PatternDebuggerProbe *** Script: Debug ::AUO::undefined
09/14/18 06:56:58 (511) Worker-Interactive:PatternDebuggerProbe *** Script: Debug ::Samsung Electric Company::undefined
.
.
.
09/14/18 06:56:58 (543) Worker-Interactive:PatternDebuggerProbe *** Script: Debug ::Dell Inc.::undefined
09/14/18 06:56:58 (543) Worker-Interactive:PatternDebuggerProbe (69)DebuggerPatternExecutor - Finished Step [name='update cmdb_ci_display_hardware 1', functor=TransformTableClosure:TRANSFORM_TABLE:0bf384a6-4adb-408f-8ea3-f49ce06aca17] with status [{type = SUCCESS}] execution took 47 ms
09/14/18 06:56:58 (699) Worker-Interactive:PatternDebuggerProbe Enqueuing: C:\MID_Server_DEV\agent\work\monitors\ECCSender\output_0\ecc_queue.a196f021dba0e700be8df81d0f9619d3.xml
09/14/18 06:56:58 (714) Worker-Interactive:PatternDebuggerProbe Worker completed: PatternDebuggerProbe source: 10.72.10.71 time: 0:00:00.453
09/14/18 06:56:58 (996) ECCSender.1 Sending ecc_queue.a196f021dba0e700be8df81d0f9619d3.xml
09/14/18 06:57:21 (074) LogStatusMonitor.60 stats threads: 45, memory max: 1820.0mb, allocated: 312.0mb, used: 95.0mb, standard.queued: 0 probes, standard.processing: 0 probes, expedited.queued: 0 probes, expedited.processing: 0 probes, interactive.queued: 0 probes, interactive.processing: 0 probes

You can see that my debug line shows mfgSysID as Undefined.  'AUO' and 'Samsung Electric Company' are both in the core_company table.

Using [*] in the first line brings back ALL rows and doesn't work.  Good thought to try.

 

I'm scratching my head ....

 

Tom