Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Building a UI Page, Issue using GlideAjax in Client script

Kapil Chopra
Tera Contributor

I am trying to get value in UI Page Client Script via GlideAjax,however when I try to destroy the window it doesn't close the UI page or save the record.

This UI Page is called via UI action has only one reference field 

 

var gaLoc = new GlideAjax('someutil');
gaLoc.addParam('sysparm_name', 'getLocation');
gaLoc.addParam('sysparm_assignmentGrp', 'Location');
gaLoc.getXML(assgnLocSysid);

// the callback function for returning the result from the server-side code
function assgnLocSysid(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('assignment_group', assigmentgrp);
g_form.setValue('location', answer);
GlideDialogWindow.get().destroy();
g_form.save();

}

 

1 ACCEPTED SOLUTION

Not applicable

try :

 

var gaLoc = new GlideAjax('someutil');
gaLoc.addParam('sysparm_name', 'getLocation');
gaLoc.addParam('sysparm_assignmentGrp', 'Location');
gaLoc.getXML(assgnLocSysid);

function assgnLocSysid(response) {
  var answer = response.responseXML.documentElement.getAttribute("answer");
  g_form.setValue('assignment_group', assigmentgrp);
  g_form.setValue('location', answer);
  g_form.save();
  GlideDialogWindow.get().destroy();
}

View solution in original post

6 REPLIES 6

Not applicable

try to log and see if you get the data. if not fix the serverside script to fix it...

if you are using OOTB location field then it is a reference field so while setting this field make sure you are setting record's sys_id to the location.