Duplication of Additional Comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 02:13 AM
Hi All,
I have written 2 Business Rules for copying comments from Case to Incident and from Incident to Case respectively. However, Comments get copied from Case to Incident but when i post a comment in Incident, same comment is displayed twice.
Business Rules are as follows, along with the Duplicate Comment Screenshot.
Any help on this is higly appreciated.
From Case to Incident:
When to run: After Update
var latest = current.comments.getJournalEntry(1);
var notes = latest.substring(latest.indexOf(")")+1).split("/n/n");
var gr = new GlideRecord('incident');
gr.addQuery('sys_id',current.parent);
gr.query();
gs.log('Before if','AD');
if(gr.next())
{
gr.comments = "Comments updated from "+current.number+"\n"+notes;
gr.update();
}
From Incident to Case:
When to run: After Update
var latest = current.comments.getJournalEntry(1);
var notes = latest.substring(latest.indexOf(")")+1).split("/n/n");
var gr = new GlideRecord('sn_customerservice_case');
gr.addQuery('sys_id',current.u_case);
gr.query();
if(gr.next())
{
gr.comments = "Comments updated from "+current.number+"\n"+notes;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 11:07 AM
Try adding this 2 lines below and see what happens in From Incident to Case,
From Incident to Case:
When to run: After Update
var latest = current.comments.getJournalEntry(1);
var notes = latest.substring(latest.indexOf(")")+1).split("/n/n");
var gr = new GlideRecord('sn_customerservice_case');
gr.addQuery('sys_id',current.u_case);
gr.query();
if(gr.next())
{
gr.autoSysFields(false);
gr.setWorkflow(false);
gr.comments = "Comments updated from "+current.number+"\n"+notes;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 10:07 PM
Hello Nari,
Thanks for the Reply!
I added those two lines in my Script. The Duplicate issue is resolved but now the comment is not getting copied to Case Ticket from Incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 10:12 PM
Hi AD,
Try before update. It worked for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2018 10:40 PM
Hi Vikram,
Thanks for the Reply!
I tried with before update but still not working!