
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 02:09 AM
Hi,
I've a 3rd Party Integration. They raise a request from their tool and one REQ is being generated in ServiceNow through a catalog Item and corresponding RITM is being assigned to a particular Assignment group defined in the process.
However, I'm seeing an SCTask under that RITM is also being generated with blank Assignment group.
How I can copy the same assignment group from the RITM to underneath SCTask.
I'm thinking to write a BR in SCTask table where it'll copy the assignment group from RITM to that particular record in SCTask.
Can anyone please help on this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 02:41 AM
Hi @Bijay Kumar Sha ,
In the catalog item, there will be either flow/workflow attached. Please check that there will be one activity for creation of sctask. You can define the assignment group there or you can copy the same assignment group as of RITM as below in the catalog task in workflow:
You can achieve it via business rule on sc_task table:
(function executeRule(current, previous /*null when async*/ ) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('sys_id', current.request_item);
ritm.query();
if (ritm.next()) {
ritm.assignment_group = current.assignment_group;
ritm.update();
}
})(current, previous);
Mark this as Helpful / Accept the Solution if this helps
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 02:21 AM
Hi @Bijay Kumar Sha You can write a Business Rule (BR) on the SCTask table that triggers whenever a new record is inserted (insert/update), and it will copy the Assignment Group from the corresponding RITM.
(function executeRule(current, previous /*null when async*/) {
var ritmGr = new GlideRecord('sc_req_item');
if (ritmGr.get(current.request_item)) {
current.assignment_group.setDisplayValue(ritmGr.assignment_group.getDisplayValue());
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 02:25 AM
Hi @Sid_Takali ,
Can you please let me know, if it's generic or specific to the catalog item that I'm talking about? Because, there might be chances for other RITMs, underneath there may be multiple SCTasks and those are assigned to different assignment groups.
For this, I've one catalog item and assignment group is getting populated in the RITM level not in corresponding SCTask.
Hope you get my point
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 02:24 AM
You can do so using a BR or where you are generating the SC_task (flow/workflow).
I would suggest you start writing something and post here if it doesn't work.
Add conditions that it runs only for RITMs created for this catalog item and also only for this task.
copying assignment group would be like below, current is your sc_task here
current.assignment_group = current.request_item.assignment_group;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2024 02:38 AM
You will need to check on your setup. If you have a separate (work)flow or logic for just this RITM, you can apply it in there. If it's a generic one, you need to adjust it to only do it for this item.
Without knowing your setup, there are too many possible ways to do this (BR's, workflows, flows, and even on load scripts).
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark