- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2015 11:39 AM
I am attempting to call a script include from a client script. The script include is working in both one of my business rules and from a UI Action. I made modifications for the script include to include the GlideAjax constructor then created the Client Script to use the AbstractAjaxProcessor. As soon as I do this I get the error shown below. I was sure to check the client callable checkbox. I am working within the scope of an application and tried both options of the Accessible from field, (i.e. "All Application Scopes" and "This Application Only"), with no luck.
After attempting to troubleshoot my script I thought I would try the one from the Wiki article. The very simple "HelloWorld" example. I was thinking this and some of the other examples might shed light on where I went wrong. Low and behold I get the same error and a null message for my response. I am attempting this in a Fulji instance in an onChange client script. At one point I even copied and pasted the code "as is" from the Wiki and tried that, but unfortunately it too returned this error. Below is the code I am currently attempting to get working. Does anyone have a clue as to what the issue might be ? ... this is as simple as it gets.
Client Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('ATest'); // I believe this should define the processor from the script include
ga.addParam('sysparm_name','helloWorld');
ga.addParam('sysparm_user_name',"Bob");
ga.getXML(HelloWorldParse);
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
}
}
Script Include:
var ATest = Class.create();
ATest.prototype = Object.extendsObject(AbstractAjaxProcessor, {
helloWorld: function() {
return "Hello " + this.getParameter('sysparm_user_name') + "!";
},
type: "ATest"
});
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2015 12:06 AM
A slight change in your script include.
When you are writing script include in application scope please include global.AbstractAjaxProcessor
var ATest = Class.create();
ATest.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
helloWorld: function() {
return "Hello " + this.getParameter('sysparm_user_name') + "!";
},
type: "ATest"
});
Let me know if it was helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2016 02:38 AM
i am using Helsinki Version of Servicenow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2016 08:12 PM
You might also want to check this article out: One of the best breakdowns of client side GlideRecord and GlideAjax ServiceNow Pro Tips — GlideRecord & GlideAjax: Client-Side Vs. Server-Side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2016 09:30 AM
The link you are referencing is not accesible