how to use glideajax in scoped application?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 10:51 PM
I tried glideajax in scoped application by using getXML i am trying to assign value to a field it is not assigning.
client script:-
function onSubmit() {
var glideDateTime = new GlideAjax("DOMSPOAjaxUtils");
glideDateTime.addParam("sysparm_name", "currentDateTime");
//glideDateTime.getXMLWait();
glideDateTime.getXML(getResponse);
//var answer = glideDateTime.getAnswer();
function getResponse(response) {
alert('Hi121');
var answer = response.responseXML.documentElement.getAttribute("answer");
if (g_form.getValue('state') == '2') {
alert('Hi' + answer);
g_form.setValue('u_hold_start', answer);
g_form.setValue('u_hold_end', '');
} else {
if (g_form.getValue('u_hold_start') != '') {
g_form.setValue('u_hold_end', answer);
}
}
}
}
script include:-
var DOMSPOAjaxUtils = Class.create();
DOMSPOAjaxUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
currentDateTime: function() {
var glideRecord = new GlideDate();
var gDate = glideRecord.getByFormat('MM/dd/YYYY hh:mm:ss a');
gs.log('Hi3242342'+gDate);
return gDate;
},
type: 'DOMSPOAjaxUtils'
});
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2023 04:23 AM
in your Client Scrip the call to the Script Include has to be prepended with the (technical) scope name and a dot.
Not
var glideDateTime = new GlideAjax("DOMSPOAjaxUtils");
but (just an example!)
var glideDateTime = new GlideAjax("sn_fsm.DOMSPOAjaxUtils");
Basically, you get the correct name from the field "API Name" in your Script Include form.
Maik