- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 11:45 AM
Hello,
I am trying to use the below mail script to fetch only the latest comment for our HR Case email notifications. When I test this, it's also pulling in [code] and [/code] tags into the comment body. How can these be removed?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 12:06 PM - edited 06-17-2024 12:10 PM
Hi @Msteiner94 I have tested the same script in Incident form on my PDI. It is working fine for me.
Use the below code, it will work for you.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var latestcommentsare = current.comments.getJournalEntry(1);
template.print(latestcommentsare);
// Add your code here
})(current, template, email, email_action, event);
Share your Notification screenshot where you are calling email script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 12:06 PM - edited 06-17-2024 12:10 PM
Hi @Msteiner94 I have tested the same script in Incident form on my PDI. It is working fine for me.
Use the below code, it will work for you.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var latestcommentsare = current.comments.getJournalEntry(1);
template.print(latestcommentsare);
// Add your code here
})(current, template, email, email_action, event);
Share your Notification screenshot where you are calling email script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 12:47 PM
Hi @Msteiner94,
There could be a cleaner way of doing things but you can simply remove those tags via a script, e.g:
template.print(latestcommentsare.replace('[code]', '').replace('[/code]', '') );
Cheers