- 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 04:29 PM
Sorry for the lack of disclaimer. My code is untested. Can you send me the error (or warning) log message that is complaining about the syntax, or a screenshot if I've made a grotesque syntax error that is prrventing you from saving? I don't see it here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2016 04:43 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2016 04:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2016 05:07 PM
I fixed it. Somehow there was an extra bracket and function section in the code. I will test it and get back to you! Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2016 08:53 PM
P.S. Bobbie Singh (Sukhwinder) says hi! You were her teacher in the Service Now course