Duplicate additional comments /Work notes getting created

nkumari
Tera Contributor

Have before BR on RITM and Task table with condition additional comments or work notes changed. It is creating duplicate additional comments and worknotes entry.

 

BR on RITM

var comment;
    var grtask = new GlideRecord('sc_task');
    grtask.addQuery('parent', current.sys_id);
    grtask.query();
    if (grtask.next()) {
 
        comment = current.comments;
        grtask.comments = comment;
grtask.work_notes = current.work_notes;
        grtask.update();
 
    }
 
BR on SC Task
 
var gr = new GlideRecord('sc_req_item');
gr.get(current.request_item);
gr.comments = current.comments;
gr.work_notes = current.work_notes;
gr.update();
 
Please if anyone can help me on this.
1 REPLY 1

Karan Chhabra6
Mega Sage
Mega Sage

Hi @nkumari,

 

It is probably going into a loop, that's why you can see multiple worknotes
Please refer to the solution given by Sravani44 on this thread, it should work for you:
https://www.servicenow.com/community/developer-forum/sync-ing-ritm-and-sctask-work-notes-additional-...

 

If my answer has helped with your question, please mark it as correct and helpful

 

Thanks!