- 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:00 AM
try this
inc.comments = current.comments.getJournalEntry(1).match(/\n.*/gm).join("\n");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 03:18 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 03:32 AM
try removing \n
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 03:37 AM
Hi,
It is not working as expected
Thanks,
Nikita
inc.comments = current.comments.getJournalEntry(1).match(/\n.*/gm).join('');