null in GlideAJAX ScriptInclude

Community Alums
Not applicable

Hi,

I am getting null for GlideAJAX answer value. Kindly help.

 

GlideAJAX

 

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

    var ga = new GlideAjax("getVendorInfoClass");
    ga.addParam("sysparm_name", "getVendorInfoFunction");
    ga.addParam("sysparm_VenID", newValue);
    ga.getXML(callBackFunction);
	alert("new value is " + newValue);

    function callBackFunction(response) {
        var answer = response.responseXML.documentElement.getAttribute("answer");
		var op = JSON.parse(answer);
		alert("answer is " + answer);
		g_form.setValue("vendor_technical_contact_name",op.callerName);
        g_form.setValue("vendor_technical_contact_phone",op.callerPhone);
	//	g_form.setValue("vendor_technical_contact_email","" );
    }

}

 

GlideAJAX.PNG

 

ScriptInclude

 

var getVendorInfoClass = Class.create();
getVendorInfoClass.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    getVendorInfoFunction: function() {
        var param = this.getParameter("sysparm_VenID");
        var compCode = new GlideRecord("core_company");
        compCode.addQuery("sys_id", param);
        compCode.query();
        if (compCode.next()) {
            var jsonOBJ = {};
            jsonOBJ.callerName = compCode.getValue("name");
            jsonOBJ.callerPhone = compCode.getValue("phone");
            //	jsonOBJ.callerEmail = compCode.getValue("u_asset_classification");
            var json = new JSON().encode(jsonOBJ);
            return json;
        }
    },

    type: 'getVendorInfoClass'
});

 

ScriptInclude.PNG

 

Regards

Suman P.

10 REPLIES 10

Community Alums
Not applicable

Thank you all, I made use of auto populate.

Regards

Suman P.