Copying RITM worknotes and comments to TASK are generating duplicate comments on RITM activity

nisha29
Kilo Contributor

Hi Team,

Could you please help me to remove Task work_notes and comments from RITM Activity.

Here is my business rule 

written on Before Update

(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.work_notes = current.work_notes;
gr.comments = current.comments;

gr.update();

}
// Add your code here

})(current, previous);

find_real_file.png

7 REPLIES 7

How many business rules total are running? Is is just copying from RITM -> Task or does it copy both ways to keep RITM/Task in sync?

Shruti17
Kilo Contributor

For me it is duplicating once on RITM. It's because of the other business rule which is to copy updated thing from task to RITM. 

nisha29
Kilo Contributor

@Elijah Aromola there two business rules are running on before update 

one is on sc_req_item table which will move the comments to related task and another if for sc_task table which move the comments to RITM which is working fine but it is throwing back to RITM activity if we changed comments from RITM side.