client script with glide ajax is not working

dvass0107
Tera Contributor

Hi Friends,

I have written a Script include made client callable with glide ajax. I am trying to fetch the caller manager into short description , when caller is changed. But its give the below error.

onChange script error: TypeError: gax.addParm is not a function function () { [native code] }

 

Client Script:

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

   //Type appropriate comment here, and begin script below
   var ga = new GlideAjax("GetManager");
   ga.addParam("sysparm_name", "callerMgr");
   ga.addParam("sysparm_caller", g_form.getDisplayValue('caller_id')); // instead I have tried with newValue also but same error
   ga.getXMLAnswer(callFunc);
   function callFunc(response){
    var answer = response;
    if (answer) {
        var shortDesc = g_form.getValue('short_description');
        g_form.setValue('short_description','Manager'+answer+ ' - '+shortDesc);
    }
   }
   
Script Include;
 
var GetManager = Class.create();
GetManager.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    callerMgr: function() {
        var gx = this.getParameter('sysparm_caller');
        var gr = new GlideRecord("sys_user");
        if (gr.get(gx)) {
            return gr.manager.name.toString();
        }

        return '';
    },
    type: 'GetManager'
});
  Can you please help me on this?
}
12 REPLIES 12

folusho
Tera Guru

@dvass0107 

 

Your error message says:

"onChange script error: TypeError: gax.addParm is not a function function () { [native code] }"

 

But your GlideAjax is declared as ga

Make sure you are not calling gax.addParm

 

Can you confirm?

 

Hi Folusho,

As per my code above mentioned there is no gax.addParm  that you can see

 

Thanks

Srinivas

@dvass0107 

 

So can you let me know the current error you are getting now?