Copy additional comments from sc task to ritm on SP

John Vo1
Tera Guru

Has anyone created a business rule that will copy the sc task comments to RITM in SP view?

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Hi John,

 

You need use write a before Update Business rule on Catalog Task table with condition as Additional comments changes which will copy comments to RITM. Something as below should help.

If it is worknotes you using then replace comments in code below with work_notes.

(function executeRule(current, previous /*null when async*/) 
{
var com = "Catalog Task Comments for " + current.number + " : " + 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= "Catalog Task Comments for " + current.number + " : " + current.comments;
v_gRITM.update();
}
})(current, previous);

View solution in original post

6 REPLIES 6

Jaspal Singh
Mega Patron
Mega Patron

Hi John,

 

You need use write a before Update Business rule on Catalog Task table with condition as Additional comments changes which will copy comments to RITM. Something as below should help.

If it is worknotes you using then replace comments in code below with work_notes.

(function executeRule(current, previous /*null when async*/) 
{
var com = "Catalog Task Comments for " + current.number + " : " + 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= "Catalog Task Comments for " + current.number + " : " + current.comments;
v_gRITM.update();
}
})(current, previous);

how would the script look like if I wanted to remove the highlighted part?

find_real_file.png

It comes from line.

var com = "Catalog Task Comments for " + current.number + " : " + current.comments;

replace it with

var com = current.comments;

this is very good and I have it working.

how would i  get  it to work the other way  and write for item done to  the task when the user updates the request item from the portal with out getting  in  a loop