Calling JavascriptProbe from UI action menu

Ankit Bansal
Kilo Contributor

Hello,

I am very new to ServiceNow and trying to learn/create application using studio.

I have created a table from where using "UI Action" i could able to read data from that new table. now i would like call a ECC queue for this. Written below test code but when i click on UI action menu its return error "org.mozilla.javascript.EcmaError: "Test " is not defined. 

Can we not call Script include by this? 

+++++ Code in UI action +++++
var test = new Test();
test.TestSync();
+++++++++++++++++++

+++++ Code in Script include +++++
var Test =Class.create();
Test.prototype={
initialize :function(){
gs.info("Test");
},
TestSync :function(){
var jspr = new JavascriptProbe('MyMIDServer');
jspr.setName('TestLog');
jspr.setJavascript('ms.log("TestLog");');
jspr.create();
},

type :'Test'};
+++++++++++++++++++

1 ACCEPTED SOLUTION

Okay. Add global. Infort of the script include name Var jspr = new global.javascriptProbe(....)

View solution in original post

17 REPLIES 17

Script include is active and client callable also checked. getting following error

org.mozilla.javascript.EcmaError: "JavascriptProbe" is not defined.

Go to Script Includes and search for name JavascriptProbe 

Do you find a script include named JavaScript Probe ? 

yes I found under System Definition -> Script includes -> JavascriptProbe and its Global. and also marked as "All Application Scopes" but still getting below error -'JavascriptProbe undefined, maybe missing global qualifier'

is there any other setting need to be done?

Okay. Add global. Infort of the script include name Var jspr = new global.javascriptProbe(....)

Yes, just now I also figure out the same. Thanks a lot Aman.

This is created as a 'Output' ECC Queue, but didn't find any print statement in my MID logs "agent0.log.0" or "agent1.log.0".  Do we need to change existing javascriptProbe for this?