How to call script include in workflow?

kalyan778
Mega Guru

Hi All,

Can you anyone please let me know how to call script include from workflow.

Script include:

var HelloWorld = Class.create();  

HelloWorld.prototype = Object.extendsObject(AbstractAjaxProcessor, {  

  helloWorld: function() {  

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

  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;  

 

  },

Thanks in advace

1 ACCEPTED SOLUTION

kalyan778
Mega Guru

We used a separate function in the same SI , it resolves that issue.

View solution in original post

8 REPLIES 8

Hi Kalyan,



new HelloWorld.helloWorld(a)



In the above script a should be the value you wanted to pass it to script include function


Nestor Paredes
Tera Contributor

Just as a side note, it seems that the only place you can call script includes on a workflow are the Script activities.

The same code just does not run calling it from the code area on an approval activity for example.

 

The solution was to load the script include on a Script activity and dump the values on the scratchpad and then call these from whenever you need.

kalyan778
Mega Guru

We used a separate function in the same SI , it resolves that issue.

Thanks Kalyan, will have that in mind the next time.