how to use glideajax in scoped application?

Narayana Swamy
Tera Contributor

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

Maik Skoddow
Tera Patron
Tera Patron

Hi @Narayana Swamy 

 

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