Some Weird issue in script include while geting the parameters value

Debasis Pati
Tera Guru

Hello Below is the script include 

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

    initialize: function()
    {

var use = this.getParameter('sysparm_user_name');
var userrrr = this.getParameter('sysparam_tery');
gs.info("manager----"+use);
gs.info('Rahul coming---'+userrrr);

return true;
    },

    type: 'getD'
});


The below is the 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('getD');
   ga.addParam('sysparm_name','initialize');
   ga.addParam('sysparm_user_name',newValue);
   ga.addParam('sysparam_tery','Rahul');

    ga.getXMLAnswer(gaResponseParse);  // Call the response parser function

    function gaResponseParse(answer) {

        alert("Hello Response: " + answer);  // Display the returned answer

    }
   
}

can you let me know what is wrong i am getting the gs.info values from the script include is undefines

The script include is already client callable checked.
 
@Ankur Bawiskar if you can let me know what is wrong will be helpful

@








2 REPLIES 2

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

Initialize is a constructor function, which is used to initialize objects in your script.

You cant call that from client side.

Use this

Script include

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

    myFunction : function()
    {

var use = this.getParameter('sysparm_user_name');
var userrrr = this.getParameter('sysparam_tery');
gs.info("manager----"+use);
gs.info('Rahul coming---'+userrrr);

return true;
    },

    type: 'getD'
});

 

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('getD');
   ga.addParam('sysparm_name','myFunction');
   ga.addParam('sysparm_user_name',newValue);
   ga.addParam('sysparam_tery','Rahul');

    ga.getXMLAnswer(gaResponseParse);  // Call the response parser function

    function gaResponseParse(answer) {

        alert("Hello Response: " + answer);  // Display the returned answer

    }
   
}
-Anurag

Mani A
Tera Guru

Write new function in script include instead of intilaize..and call it from glideajax in sysparam_name