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-23-2019 12:55 AM
Did you try with the solutions provided by others?
And also try with current.variable_pool.list_collector

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 10:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2019 01:30 AM
HI All,
Thanks for prompt reply.
I have configured the-
var group = current.variables_pool.u_group.getDisplayValue();
var groups = group.split(",");
gs.log(group);
gs.log(groups);
var m = new GlideRecord("sc_task");
m.initialize();
for(var i=0;i<groups.length; i++){
task.assignment_group = groups[i];
task.insert();
}
The number tasks are generated correctly, but the assignment group is blank for all task.
Not sure if I am missing something.
This I have configured in activity of workflow.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2019 01:44 AM
Hello,
Try with the below code
var m = new GlideRecord("sc_task");
m.initialize();
for(var i=0;i<groups.length; i++){
m.assignment_group = groups[i];
m.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2019 03:24 AM
Hi,
Try the below code
var group = current.variables_pool.u_group.getDisplayValue();
var groups = group.split(",");
gs.log(group);
gs.log(groups);
var m = new GlideRecord("sc_task");
m.initialize();
for(var i=0;i<groups.length; i++){
task.assignment_group.setDisplayValue(groups[i]);// You have stored name of the groups in group variable so you need to use setDisplayValue.
task.insert();
}
Please make correct/helpful, if it's applicable.
Thanks,
Vinay