How to copy the Assignment Group Name from RITM to SCTask

Bijay Kumar Sha
Giga Guru

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?

1 ACCEPTED SOLUTION

SN_Learn
Kilo Patron
Kilo Patron

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:

SN_Learn_0-1721813708096.png

 

 

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.

View solution in original post

5 REPLIES 5

SN_Learn
Kilo Patron
Kilo Patron

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:

SN_Learn_0-1721813708096.png

 

 

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.