Add additional comments to RITM and Task

John Vo1
Tera Guru

Will this script work to copy additional comments from RITM to Task and Task to RITM whichever one is updated with additional comments?

 

(function executeRule(current, previous /*null when async*/)
{
var com = current.comments;
var v_gRITM = new GlideRecord('sc_req_item');
v_gRITM.addQuery('sys_id', current.request_item);
v_gRITM.query();
if (v_gRITM.next())
{
v_gRITM.comments= current.comments;
v_gRITM.update();
}
})(current, previous);


(function executeRule(current, previous /*null when async*/) {

updateTasks();

function updateTasks() {

var sctask = new GlideRecord('sc_task');
sctask.addQuery('request_item', current.sys_id);
sctask.query();
while (sctask.next()) {
sctask.work_notes = 'Additonal Comment from RITM' + current.comments;
sctask.update();
}
}

})(current, previous);

10 REPLIES 10

Gary Larsen
Mega Sage

I have this working so I can enter comments on the task and it copies to RITM but I have to right click in header and hit save for it to work.

How can I get the post button to work at task level?