Unhandled Exception in GlideAjax for API Response

appstorm
Tera Contributor

...Not sure where I should look to fix this error, but including both my CS and SI for help.  My thought is to place multiple values into an object then stringify (convert the object to a string) and return to the client script.  Not sure if this will fix the issue or not.

 

CS

function onLoad() {

    //Type appropriate comment here, and begin script below

    var ga = new GlideAjax('Test');

    ga.addParam('sysparm_name', 'CourseUtils');

    ga.getXML(CourseUtilsOutput);

}

function CourseUtilsOutput(response) {

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

    alert(answer);

    var objJSON = JSON.parse(answer);

    for (var i = 0; i < objJSON.courses.length; i++) {
        var choice = objJSON.courses[i];
        g_form.addOption('course_information', choice.SUBJ_CODE + ' ' + choice.CRSE_NUMB + ' ' + choice.SEQ_NUMB, choice.TERM_DESC);
    }

}

 

SI

var Test = Class.create();

Test.prototype = Object.extendsObject(AbstractAjaxProcessor, {

 CourseUtils: function()

   {

   try {

   var r = new sn_ws.RESTMessageV2('Banner Student', 'get');

   var response = r.execute();

   var responseBody = response.getBody();

   var httpStatus = response.getStatusCode();

   return responseBody;

   }

   catch(ex) {

   var message = ex.getMessage();

   return "";

   }

   },

       type: 'Test'

});
2 REPLIES 2

saivishwaja val
Tera Contributor

What's the error you are getting 

is integration working good what did you receive in status code

Brad Bowman
Kilo Patron
Kilo Patron

Add some logs to the SI to confirm it is running, see how far it is getting, and if anything is getting returned - this error usually points to the SI not running and/or not returning anything.