How can i remove timestamp values from comments when i am passing it in notification through email script in one new row of table

Neha Tiwari5
Tera Contributor

How can i remove timestamp values from comments when i am passing it in notification through email script in one new row of table

1 ACCEPTED SOLUTION

Saurav11
Kilo Patron
Kilo Patron

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

View solution in original post

5 REPLIES 5

shloke04
Kilo Patron

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

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke