Copying Assigned to from SCTask to RITM Asssigned To

John H1
Tera Guru

How can I copy the Assigned To value in SCTask to Assigned To in RITM?

1 ACCEPTED SOLUTION

Amitoj Wadhera
Kilo Sage

Hi @John H1 ,

 

Create a After Update Business rule on sc_task table:

var ritmGR = current.request_item.getRefRecord();
ritmGR.assigned_to = current.assigned_to;
ritmGR.update();

 

If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.

 

Thanks,

Amitoj Wadhera

View solution in original post

5 REPLIES 5

Amitoj Wadhera
Kilo Sage

Hi @John H1 ,

 

Create a After Update Business rule on sc_task table:

var ritmGR = current.request_item.getRefRecord();
ritmGR.assigned_to = current.assigned_to;
ritmGR.update();

 

If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.

 

Thanks,

Amitoj Wadhera

Kieran Anson
Kilo Patron

A business rule would do the job however a RITM can have multiple sctasks. Has that been considered?

SAI VENKATESH
Tera Sage
Tera Sage

Hi @John H1 

 

You can follow the below Link and it matches your requirement

https://www.servicenow.com/community/developer-forum/copy-assignment-group-from-sctask-to-ritm/m-p/1...

 

Thanks and Regards

Sai Venkatesh

Unique45
Mega Sage

@John H1 ,

Create after update business on sc_task table and add following code:

(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.assigned_to = current.assigned_to;
ritm.update();
}

})(current, previous);

Please refer following screenshots:

 

Unique45_0-1717513532647.png

 

 

 

Please mark correct/helpful if this helps you!