The CreatorCon Call for Content is officially open! Get started here.

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.

 

11 REPLIES 11

Hi @Narayana Swamy ,

 

can u put an alert on answer variable in client script n check whether u receiving anything or not also at the beginning of the script include after the function is called put a log n check if that is getting printed.

 

Thanks,

Danish

 

Hi @Danish Bhairag2  

I checked by using alert the date is coming from script include but not assigning date value to the field.

@Narayana Swamy Could you please confirm in which scope your script include is defined. Is it in Global scope or application scope?

Hi @Sandeep Rajput  

It was in application scope

@Narayana Swamy Please update your script include code as follows and your client script will start working.

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.info('Hi3242342'+gDate);
        return gDate;
    },

    type: 'DOMSPOAjaxUtils'
});

 

gs.log is not supported in the scoped application, your script is crashing due to the same reason and you were not able to see output due to this issue. I replaced gs.log with gs.info, hope this fixes your issue.

 

For more information this topic, please refer to the support article https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0788208

 

Hope this helps.