- 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-07-2016 02:50 PM
Hi Zabrina,
Sure. You can create an onAfter Business Rule that runs on insert / update of the request table. On the script of that business rule you will do a search on the sc_req_items (requested items) table and retrieve all the record where the parrent is the current request. Within the iteration of that glide record you will then update the assignment group according to the assignment group of the request.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2016 02:51 PM
I hope this helps .
Thanks,
Berny

- 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-07-2016 03:48 PM
Hi I tried this but it didn't work. Something is wrong with the syntax. Thanks.