- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2024 12:59 PM
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();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 12:38 AM
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();
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2024 04:30 PM
Can you try switching the last 2 line order?
You should save the form before destruction the Modal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 12:06 AM - edited 03-26-2024 12:08 AM
Ok will try and update , however same sequence without any Ajax calls and hard-coded value works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 12:38 AM
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();
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 01:45 AM
After making the changes to the code ,now assignment group gets set, however location is still undefined and the form doesn't save because location is mandatory. it seems due to GlideAjax we don't get value of location before g_form.save.