Accessing global script include from scoped app

martin_chabarri
Mega Expert

I am trying to do a simple GlideAjax from a scoped app, where I am calling a function in a global script include.

Client Side

function onSubmit()

{

var date = g_form.getValue("date_var");

var ga = new GlideAjax("MyInclude");

ga.addParam("sysparm_name", "getThisWeek");

ga.addParam("sysparm_ddate", date);

ga.getXML(ajaxResponse);

function ajaxResponse(response) {

var answer = response.responseXML.documentElement.getAttribute("answer");

alert(answer);

Script Include

var MyInclude = Class.create();

MyInclude.prototype = Object.extendsObject(AbstractAjaxProcessor, {

getThisWeek: function(){

gs.info('**mc: here i am');

var ddate = this.getParameter('sysparm_ddate');

if(ddate < gs.daysAgo(7)){

return true;

}

}

});

I am not getting any logs or errors, it just seems that it is not calling the include at all.

6 REPLIES 6

dvp
Mega Sage

Is the script include made available to all application scopes?



find_real_file.png


Yes it is marked as All application scopes


you need to use getXMLWait for onsubmit client script


Thanks for the suggestion.



I just tried and still no bueno.



Whats odd, it allows submission even with the synchronous call, and never hits the gs.info in the script include