Based on list collector values , create catalog task in workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 01:50 AM
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
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 02:02 AM
Hello,
Do you want to create each task for selecting a group?
For example, if you select two groups two tasks will be created?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 07:39 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 08:46 PM
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();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 10:11 PM