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

The one given by Michael is the minimized and most feasible one.


I tried this syntax in a similar business rule writing a field (not Comments) from the Task to the RITM. I cannot seem to get it to run. do you see anything that I am doing wrong?

var rej = new GlideRecord('sc_req_item');
rej.get(current.request_item);
rej.comments = current.u_vm_rejection_comments;
rej.update();

 

Thanks for any guidance!