srinivasthelu
Tera Guru

Hi Kalyan,



Check out the worklfow, add a new run script activity and call something like this.



new ScriptIncludeName().functionName();



In the above scenario, the HelloWorld function cannot be callable from script include as it is written to accept parameters through AJAX.



You can modify the above script something like below,




var HelloWorld = Class.create();


HelloWorld.prototype = Object.extendsObject(AbstractAjaxProcessor, {


  helloWorldAjax: function() {


var arr=this.getParameter('sysparm_user_name') ;


this.helloWorld(arr);


},


helloWorld: function(arr1) {


  var values = '';


  var array = arr1.split(',');


  for(i=0;i<array.length;i++)


  {


  var the_choice = new GlideRecord('sys_user_grmember');


  the_choice.addQuery('sys_id', array[i]);


  the_choice.query();


  if(the_choice.next()){


  values = the_choice.user.user_name.getDisplayValue() + "," + values;



}


  }


return values;


  }


 


  }