- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2022 11:06 PM
How can i remove timestamp values from comments when i am passing it in notification through email script in one new row of table
Solved! Go to Solution.
- Labels:
-
Cost Management (ITSM)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2022 11:20 PM
Hello Neha,
Below is working expression you can use to remove the timestamp from the comments
current.comments.getJournalEntry(1).match(/\n.*/gm).join("\n");
Please mark answer correct/helpful based on Impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2022 02:40 AM
Hi,
Please follow the steps below to achieve your requirement:
Within your Notification Email Script use the script as below:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var comment = current.comments.getJournalEntry(1);
var dateRE = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*\n/;
template.print(comment.replace(dateRE, ''));
})(current, template, email, email_action, event);
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke