Email Notification Showing Last Comment with <Code> Tag
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2024 06:05 PM
We want to just display the last journal entry in the email notification, but it is printing <Code> tag in the email:
Here is the OOTB show_only_last_comment email script:
And this is our email body:
There is no issue if we display all comments using ${comment}. Any suggestion on how I can get around this would be greatly appreciated.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2024 07:56 AM
Hi @Tigermomdr
in ServiceNow, the [code] and [/code] placeholders are wrapping tags to carry HTML in comments. You can remove them without loosing any functionality:
var comment = current.comments.getJournalEntry(1).split('\n')[1].replaceAll(/\[code\]|\[\/code\]/g,"");
Maik