Copy Additional comments from task to RITM

Fredo1
Giga Expert

Hi

I am looking for a Business rule to copy Additional comments from task to the corresponding RITM

So far I have this:

Table = sc_task

When = After

Insert and Update = check

Condition = current.comments.changes()

Script

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

//

var gr = new GlideRecord('sc_task');

gr.addQuery('request_item',current.sys_id);

gr.query();

while(gr.next()){

gr.comments = current.comments;

gr.update();

}

//

})(current, previous);

Many thanks in advance

1 ACCEPTED SOLUTION

Gowrisankar Sat
Tera Guru

var gr = new GlideRecord('sc_req_item'); //it should be on sc_req_item table


gr.addQuery('sys_id',current.request_item);


gr.query();


while(gr.next()){


gr.comments = current.comments;


gr.update();


}


View solution in original post

6 REPLIES 6

Gowrisankar Sat
Tera Guru

var gr = new GlideRecord('sc_req_item'); //it should be on sc_req_item table


gr.addQuery('sys_id',current.request_item);


gr.query();


while(gr.next()){


gr.comments = current.comments;


gr.update();


}


Thank you!!!


Michael Fry1
Kilo Patron

You can use something like this:


var gr = new GlideRecord('sc_req_item');


      gr.get(current.request_item);


      gr.comments = current.comments;


      gr.update();


This one is correct as well