Workflow - add change tasks to change request depending on short description

JordyZ
Mega Sage

Hi,

 

I was wondering how to add change tasks (20+) to a change request when the short description of the change request is "Server test", using workflow. Each task has a different name/type/assignment group/assigned to.

 

EDIT: For some tasks, the assigned to needs to be the requestor itself. Do I just put "assigned to" as empty in the Create task activity, and put "task.assigned_to = gs.getUserID();" in the script like this? Or do I remove remove "assigned to" in the variables and just have the script?

JordyZ_1-1698321174075.png

 

JordyZ_0-1698321425324.png

 

 

I've never worked with workflow before so any help is appreciated! 

1 ACCEPTED SOLUTION

Hi @JordyZ I would suggest to use Create Task activity in this case, your job will be easier to maintain 20 tasks in future

HarishKM_1-1698310101272.png

 

Regards
Harish

View solution in original post

4 REPLIES 4

Harish KM
Kilo Patron
Kilo Patron

Hi @JordyZ  You can use run script activity to create 20+ change task like below

 

if(current.short_description == 'Server test') // short desc of change request

for(var i =0 ; i< 20 ; i++) // to create 20 task

{

var chgTask = new GlideRecord('change_task');

chgTask.initialize();

chgTask.assignment_group.setDisplayValue("groupname");

chgTask.fieldname = ""; // for other fields mapping

chgTask.insert();

}

Regards
Harish

Hi @Harish KM ,

 

Thanks for replying. Each of the 20+ change tasks have a different name/type/assignment group. This mean I have to manually code each task?

Hi @JordyZ I would suggest to use Create Task activity in this case, your job will be easier to maintain 20 tasks in future

HarishKM_1-1698310101272.png

 

Regards
Harish

Thanks @Harish KM !

 

Sorry for asking, but what would the overall workflow look like, do I need to use Branch/Join activity or anything else?

 

The change tasks should be created in a specific order, is it possible to put order value at Create Task activity?

 

Kind regards,

Jordy