- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2018 07:03 AM
Morning!
I am looking to generate tasks based on selection of values from a list collector that I have added to a catalog item.
I.E.> if multiple values are selected, generate tasks out to those teams
Selections == Workday;OKTA;Sailpoint
Workday > Send task to workday services
OKTA > Send task to Okta Servicesa
Sailpoint > Send task to Sailpoint Services
Currently i have 6 list collector fields that contain different reference qualifiers limting data points coming from the applications table in CMDB. The values from these list collectors then will need to generate SCTASKS when selected to the assignment group indicated on the CI record.
Looking for advice on the best practices of how to achieve this.
Thank you in advance!
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2018 07:19 AM
You'll want to use a 'Run script' activity in your request item workflow to do this. The script will iterate through the values in the list collector variable and then create an 'sc_task' record for each one.
// Create 'sc_task' records for each item in the list collector var
var options = current.variables.MY_LIST_COLLECTOR_VAR_NAME;
// Iterate through the options
for (i=0; i < options.length; i++) {
// Query for the current CI
var ci = new GlideRecord('cmdb_ci');
ci.get(options[i]);
// Create a new task record for the current CI
var sct = new GlideRecord('sc_task');
sct.initialize();
sct.short_description = 'Task for ' + ci.name;
sct.assignment_group = ci.assignment_group; // Make sure this field name is correct!
sct.request_item = current.sys_id;
sct.insert();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2022 03:04 PM
Thanks William, I ran into the same issue and adding split did the trick! Appreciated 🙂