Thanks Jeff. Handy Tips and work around.

Jeff Benedict

In the last month I have been doing quite a bit of client side JavaScript using jQuery and AngularJS and initially had some challenges working with these frameworks and the ServiceNow GlideAjax object due to only being able to pass string values as a parameter.  For example, below is the example GlideAjax usage from the ServiceNow Wiki site:

var ga = new GlideAjax(‘HelloWorld’);
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);
}

The limitation for me was the “sysparm_user_name”  parameter for what if I wanted to pass in an Array, Object or a list of records to be updated?  This is especially relevant if you start leveraging AngularJS, for with AngularJS you are going to want to filter, sort and update rows of data with client side JavaScript and therefore need structured data variables for which to manipulate.

The solution for me is JSON and attached is an update set…

View original post 378 more words

Advertisements