Cannot call script include from client script

Francis
Mega Expert

Hi fellow service-now developers,

I am trying to call a "Script Include" from a "Client script", but I cannot make it works.

Client script:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    var ga = new GlideAjax('VdlAddressUtils');
    ga.addParam('sysparm_name', 'hasIdGDA');
    ga.getXML(getResponse);

    function getResponse(response) {
        var res = response.responseXML.documentElement.getAttribute("answer");
        alert(res)
    }
}

 

Script include:

var VdlAddressUtils = Class.create();
VdlAddressUtils.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
    hasIdGDA: function() {
        return "1";
    },
    type: 'VdlAddressUtils'
});

Do you know why?

 

PS: My script include is accessible remotely.

PS2: My alert shows a "Null".

 

Edit: After the suggestion of @Aman Kumar, I added a gs.info into my script include and I did get a log.

1 ACCEPTED SOLUTION

Francis
Mega Expert

Ok, got it guys.

I had a "gs.log("!!!HERE!!");" into my script include, and that causes my issue.

 

Thank you all!

View solution in original post

11 REPLIES 11

Hi Mahesh, thanks for testing it on your side. I'm trying to figure what could be different on mine.

Have a good day!

Francis
Mega Expert

Ok, got it guys.

I had a "gs.log("!!!HERE!!");" into my script include, and that causes my issue.

 

Thank you all!