- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2017 11:04 AM
Hello everyone!
I am pretty new to developing on ServiceNow and just ran into an issue with using GlideAjax. I read through the wiki article on how to use GlideAjax, and attempted making a ui action button that created a case from a custom table. Every time I used the button, I kept getting a "glideajax is not defined" in the system logs. I then copied the code from the wiki and to see what I was doing wrong. Unfortunately, I was still getting the same error.
This is the code (from the glideajax wiki) inside of my UI action
var ga = new GlideAjax('HelloWorld');
ga.addParam('sysparm_name','helloWorld');
ga.addParam('sysparm_user_name',"Bob");
ga.getXML(HelloWorldParse);
gs.log("I'm working!", 'saxton');
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
}
This is the code inside my script include
var HelloWorld = Class.create();
HelloWorld.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
helloWorld: function() {
return "Hello " + this.getParameter('sysparm_user_name') + "!";
},
_privateFunction: function() { // this function is not client callable
}
});
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2017 11:14 AM
Is your UI Action running on the server (default) or the client (Client field checked)? It will have to be a client-side one in order to call GlideAjax.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2017 11:14 AM
Is your UI Action running on the server (default) or the client (Client field checked)? It will have to be a client-side one in order to call GlideAjax.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2017 11:22 AM
Ahhh, that was the issue. I thought I had tried that before and it didn't work, but I was wrong. Thanks!