- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 10:23 AM
I am trying to remove the assignee name from the email notification and I have created an email script as below. When I test the notification, I am getting [code] [/code] in the email notification and not finding a way to get this removed.
Email Script:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var date = current.comments.getJournalEntry(1).split('\n')[0].split(' - ')[0];
var comment = current.comments.getJournalEntry(1).split('\n')[1];
template.print(date);
template.print(comment);
})(current, template, email, email_action, event);
Notification:
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 06:59 PM
Hi
Try at the end of the line where "comment" is being assigned:
var comment = current.comments.getJournalEntry(1).split('\n')[1].replace(/(\[.?*\])/g,"");
or
var comment = current.comments.getJournalEntry(1).split('\n')[1].replace(/\[code\]|\[\/code\]/g,"");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 01:21 PM
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var internalComments = '${comments}';
var date = internalComments.split('\n')[0].split(' - ')[0];
var comment = internalComments.split('\n')[1];
template.print(date);
template.print(comment);
})(current, template, email, email_action, event);
Modified your code little bit. Please check and see if this works for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 03:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 05:00 PM
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
template.print('<p><font size="3" color="#808080" face="helvetica">' + gs.getMessage('${comments}') + '</font></p>');
})(current, template, email, email_action, event);
You may try this code excerpt from OOB instance. You need not perform any split since the code will automatically take care of formatting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 05:36 PM
OOB Code will not remove the "assignee name" from the notification. I wanted that to be removed from the notification.