Based on list collector values , create catalog task in workflow

vinzz
Kilo Contributor

Hi,

 

I have a catalog item, which contains a list collector that reference to assignment groups of servicenow.

Requirement is to create catalog task for all the assignment groups selected in list collector.

Please advice.

 

Thanks in advance

15 REPLIES 15

Bhagya Lakshmi
Mega Guru

Hello,

Do you want to create each task for selecting a group?

For example, if you select two groups two tasks will be created?

Yes, I want to create catalog task, for all the groups selected in list collector,

if two groups selected then two catalog tasks & if 3 groups selected then 3 task, etc

Try below code in task activity,

var group = current.variables.list_collector;

var groups = group.split(",");

for(var i=0;i<groups.length; i++){

task.assignment_group = groups[i];

task.insert();

 

}

Hi, Create a run script activity and copy the code as below var group = current.variables.list_collector: var groups = group.split(","); var m = new GlideRecord("sc_task"); m.initialize(); for(var i=0;i