- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 11:44 AM - edited 02-15-2024 11:59 AM
When a Task is created, how can I keep the Assignment group field in sync with the RITM assignment group field.
update: as in synced at all times, if the ritm assignment group is updated then the task should be updated too
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 11:32 AM
Hi @aimughal,
No worries, so it should be the other way around - Sync RITM's assignment group from the SCTASK? You can use the same condition but change the Table to Catalog task and use the script below:
(function executeRule(current, previous /*null when async*/) {
var ritmGr = new GlideRecord("sc_req_item");
ritmGr.get(current.getValue('request_item'));
if(ritmGr.isValidRecord())
{
ritmGr.setValue('assignment_group', current.getValue('assignment_group'));
ritmGr.update();
}
})(current, previous);
Just a reminder, I don't think this is a good process and I recommend revisiting it.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 12:09 PM
Could you demonstrate what the br should be like/how it should be implemented?
Or would an 'on change' script work?
This is required so the SLA is up to date with the latest task group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 12:18 PM
Writing a BR would be pretty straightforward.
Condition will be:
And the script, you can write something like:
(function executeRule(current, previous /*null when async*/) {
var sctaskGr = new GlideRecord('sc_task');
sctaskGr.addEncodedQuery('request_item=' + current + '^active=true');
sctaskGr.query();
while(sctaskGr.next())
{
sctaskGr.setValue('assignment_group', current.getValue('assignment_group'));
sctaskGr.update();
}
})(current, previous);
BUT this doesn't mean you should be doing this, your requirement does not justify the need. I don't understand what you meant by "SLA is up to date with the latest task group." .
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 04:16 AM - edited 02-21-2024 06:19 AM
Hi James, thanks for the prompt response.
Update: it is working when I change the group on the ritm, then the task is updated. Thank you.
However I need it to only update the group on the ritm, when it's changed on the task. What would the BR script look like in this case?
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 11:32 AM
Hi @aimughal,
No worries, so it should be the other way around - Sync RITM's assignment group from the SCTASK? You can use the same condition but change the Table to Catalog task and use the script below:
(function executeRule(current, previous /*null when async*/) {
var ritmGr = new GlideRecord("sc_req_item");
ritmGr.get(current.getValue('request_item'));
if(ritmGr.isValidRecord())
{
ritmGr.setValue('assignment_group', current.getValue('assignment_group'));
ritmGr.update();
}
})(current, previous);
Just a reminder, I don't think this is a good process and I recommend revisiting it.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 01:05 PM
thanks so much!