work notes duplicating when copying between task and item

chrisp1
Mega Sage

Hi,

I have a requirement to have comments and work notes copied from items to task and vice-versa, so I have created 2 business rules to do this (as below) - the issue is that i get duplicate entires (eg a work note added to the item is copied to the task, but then as the work notes on teh task have changed this is then copied back to the item again)

Is there a better way of doing this which will avoid the duplication?

( i have tried adding the request item comments and work notes to the task form, but there does not seem to be the option to go the other way, and this still contains duplications)

thanks in advance

- before update on sc_req_item (when add comm/wn change)

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.update();

}

- before update on sc_task (when wn change)

var gr = new GlideRecord('sc_req_item');

gr.get(current.request_item);

gr.work_notes = current.work_notes;

gr.update();