- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 02:54 AM
Hi All,
I have created an after insert/update business rule on problem table to copy additional comments from problem to incident, and used below script
var inc = new GlideRecord('incident');
inc.addQuery('sys_id', current.u_reference_1);// u_refernce_1 is name of incident field on problem form
inc.query();
while (inc.next()) {
inc.comments = current.comments.getJournalEntry(1);
inc.update();
}
please help me to remove the name and timestamp as shown in above image that is also getting copied and pasting in incident additional comments..
Thanks in advance!!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 03:41 AM
Hi
I checked this in background script and its working
inc.comments = current.comments.getJournalEntry(1).match(/\n.*/gm).join('').replace(/^\s*\n/gm, "");

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 03:41 AM
Hi
I checked this in background script and its working
inc.comments = current.comments.getJournalEntry(1).match(/\n.*/gm).join('').replace(/^\s*\n/gm, "");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 03:55 AM
Hi Pranav,
Thank you for your response, Its working as expected and removing new lines.
Thanks again.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 03:04 AM
Hi Nikita,
refer solution from Deepak from below link
Remove User info and timestamp from commets
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 03:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 03:39 AM
Hi,
By using the experession below expression, it is giving unwanted lines.I dont want the unwanted lines.
match(/\n.*/gm).join("\n");
Thanks,
Nikita