Create catalog task based on List collector and set assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2023 04:08 AM
Hi All,
We have a requirement to create separate task for each option selected in the list collecter and also set assignment group. List collector is referencing to "u_list_collector_table" and we have a reference field(Assignment Group) in this table that references to group table. I'm able to create task for each option selected in list collector but unable to set assignment group. Can someone help me on this?
Below is my code in Run Script activity:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2023 04:44 AM
Hi @Community Alums ,
This Link should help you :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2023 05:15 AM
Hi @Community Alums
Thanks for the quick response. I tried the soultion which is there in the link provided by you but no luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2023 05:25 AM
@Community Alums if you have 5min for a quick call to troubleshoot?
Meeting Link: meet.google.com/jdo-fvog-ifh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2023 05:55 AM
HI @Community Alums ,
Please try using below script:
var selectedOptions = current.u_list_collector_field.split(",");
// Create a new task for each selected option
for (var i = 0; i < selectedOptions.length; i++) {
var newTask = new GlideRecord('task'); /
newTask.initialize();
var assignmentGroup = new GlideRecord('u_list_collector_table');
if (assignmentGroup.get('sys_id', selectedOptions[i])) {
newTask.assignment_group = assignmentGroup.getValue('assignment_group'); // Assuming the reference field to the assignment group is named "assignment_group"
}
newTask.insert();
}
Regards,
Riya Verma