- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2016 02:40 PM
If not, is there some sort of workaround like creating mandatory fields or notifications reminding the transferring group to change the resource group on tasks? Any suggestions would be helpful.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2016 03:01 PM
I'm going to make the following assumptions. Please correct me if I'm wrong.
- You are reassigning a request item by changing the assignment group
- You want to reassign any active/open tasks (and leave completed ones alone.)
It would be done with an AFTER business rule something like this:
Name: Reassign active tasks
Table: Requested Item (sc_req_item)
When: After
Insert: true
Update: true
Advanced: true
Condition: Assignment group | changes
Script:
(function executeRule(current, previous /*null when async*/) {
var task = new GlideRecord('sc_task');
task.addQuery('request_item', current.getValue('sys_id'));
task.addQuery('active', true);
task.query();
while (task.next()) {
task.assignment_group = current.assignment_group;
task.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2016 05:50 AM
Thanks for passing on the message.
Is there anything more I can help with to get your business rule running or has it been resolved?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2016 01:23 PM
Hi Chuck, the script works fine. However, I had one last question. How can I edit the script so that it only applies to one group instead of being a global change? I wanted it specifically for EDSS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2016 04:29 PM
You can add another line before the task.query() line.
Something like this:
task.addQuery('assignment_group', 'SYS_ID'); // change SYS_ID to the actual sys_id of the EDSS group.
To get the sys_id, go to the list of groups, right click on the EDSS group name and select Copy sys_id then paste it in the script where indicated above and it will add that filter to the tasks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2016 04:35 PM
Thank you!! Your answer was very thorough
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2016 11:05 AM
Hi Chuck, I apologize but I did not make my question clear enough. I am hoping you can answer one last request- when a RITM is assigned to a fulfiller, how can I make the tasks automatically be assigned to that person as well? The fulfiller should be able to reassign one of the tasks to other people if they wish, and not have it default back to them.
