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

When I added script for the RITM this is what I get.  Nothing shows up on the task but this.

find_real_file.png

And when I add comments in task it doesn't even show up in the RITM

Updated above as .getJournalEntry(-1) was missing.

Hello Jaspal, 
Thank you for this. .getJournalEntry(-1) was missing from where? 

I am getting the same output 'RITM Comments for RITM0010639:" and nothing else. It does not actually move the comment value.

Any help on this is greatly appreciated. Have a great day! 

@Lauren Martinez 

 

Please update below line in your code-

as catis.comments = "Catalog task comments for "+current.number+" :"+current.comments.getJournalEntry(-1);

 

If this solution helps you ,mark it as a correct

Thanks,

Manjusha Bangale