Is there a way to run a Script within a workflow and make tasks

HenryD
Tera Guru

Hello, I have a complex problem I'm trying to solve, is there a way to run a Script within a workflow and make tasks based on how many Roles are within a group, for example as an end user I'm trying to select a group I'm trying to get in and based off the Roles, those should create individual tasks to be approved. so, if I choose a group and there's 3 roles within that group, 3 Tasks should be made automatically to be approved by someone. Same as if there was 5, there should be 5 so on and so forth, 

 

Any help is appreciated, thank you in advance. 

9 REPLIES 9

@HenryD , any luck with the approach, let us know the final conclusion.

 

Hello, sorry was out sick for a while getting back to this. rn i have a script in the workflow that looks like this: 

 

var task = new GlideRecord("sc_task");

task.initialize();

task.request_item = current.sys_id;

task.short_description = 'Approver'

task.requested_for =  'requested_for';

task.approval ='requested';

task.insert();

 

How would i insert something in here or an example i can refer to? so that way i can make tasks based on how many roles are in the group, for example, if theyre are 5 roles, they should populated 5 tasks. 

 

Hi @HenryD, Let me know if we can talk and discussion, if possible then, inbox me zoom/googlemeet invite.

prasad48
Kilo Sage

You can use RUNSCRIPT workflow activity 

Hello, yes i figured it would be a runscript activity, what would an example script look like to get my solution? if you know thanks