- 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-16-2016 12:41 PM
I would use a display business rule on the Task (sc_task) table. It's kind of like an onLoad client script, but has better access to related database objects.
Check the Advanced checkbox.
When: display
Something like this:
if (current.request_item && current.isNewRecord()) {
if (current.request_item.assigned_to && current.assigned_to == '') {
current.assigned_to = current.request_item.assigned_to;
}
}
It checks if there is a parent request item and this is a new record, then checks to see if the RITM assigned to field has a value and the task is blank. Then and only then does it populate the task assigned to with the RITM assigned to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2016 11:09 AM
Hi Chuck, thank you for the script. Due to some conflicts with our own settings it did not work. otherwise the script is fine. I talked to my lead and we were able to use the business rule below to populate the task resource with the resource listed on the ritm. However, the name of the resource is not populating within the task description on the bottom of the ritm screen (as shown below). Do you know how to fix this? Thank you again for all of your help!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2016 11:12 AM
Excellent work using a scriptless solution!
Q: Are you certain the parent request item has a resource to copy from?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2016 11:16 AM
Yes it does. When I input the resource into the ritm, I save it before scrolling down to the tasks. The name just isn't showing up on that field, but when I go into the task, it is there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2016 11:35 AM
I've seen this before, but cannot find where it was. Initially it looks like an ACL issue, but since you can see the value when you go in to the record, that doesn't appear to be it. I'll keep digging and let you know what I find. Hopefully someone else can find it too.
