The CreatorCon Call for Content is officially open! Get started here.

glideajax not defined

Andrew Saxton -
Tera Expert

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        

   

    }

});

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

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.


View solution in original post

2 REPLIES 2

Jim Coyne
Kilo Patron

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.


Ahhh, that was the issue. I thought I had tried that before and it didn't work, but I was wrong. Thanks!