The CreatorCon Call for Content is officially open! Get started here.

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

Inside for loop print, i value.

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

gs.log('count--'+i);
var gm = new GlideRecord("sc_task");
gm.initialize();
gm.parent = current.sys_id;
gm.request = current.request;
gm.short_description = "default task name";  //have a default task name
gm.request_item= current.sys_id;
gm.assignment_group=xyz[i];
//gm.assignment_group.setDisplayValue(xyz[i]);
//task.assignment_group = groups[i];
gm.insert();
}

Check once.