- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:04 AM
Hi there,
I'm using email script, (a part) shown here below, to print the last given "Additional Comment" within a Incident, in an system notification (email).
template.print('<p><span style="color: #ffffff; font-family: trebuchet ms, geneva; font-size: 10pt;"><strong>');
template.print(journalEntry.value);
template.print('</strong></span></p>');
This works so far, so good. The only problem that no blank lines/paragraphs are shown in the generated email. All text is strung together.
How can I solve this problem. I've already tried something as here below, but unfortunately, that does not work. There must be an solution for this problem.
template.print('<p><span style="color: #ffffff; font-family: trebuchet ms, geneva; font-size: 10pt; p {margin-bottom: 10pt;}"><strong>');
template.print(journalEntry.value);
template.print('</strong></span></p>');
What I get:
What I want:
Any solution would be appreciated! Thanks!
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:41 AM
Use the global setting. Something like:
journalEntry.value.replace(/\n/gm, "<br/>")
P.S. or /\\n/gm, "<br/>" as regex expression (cant test it atm, sorry 😞 )

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:05 AM
Hi,
Have you tried using:
current.comments.getJournalEntry(1)
I believe same can be done directly in your notification body, without a mail script such as:
${current.comments.getJournalEntry(1)}
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:08 AM
Hello Allen,
Thank you for your reply. Yes, I've tried this, but the problem using this attibute is that the text font, format, etc. are hard to change to something else than the default "Journal Entry" style.
Yes I have tried various solutions. Please see topic: https://community.servicenow.com/community?id=community_question&sys_id=7027e17c1b99c51038739979b04bcb84 (see post 6 viewed from top to bottom).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:21 AM
Try replacing \n (new line) with <br/>. Maybe something like :
template.print(journalEntry.value.replace("\n", "<br/>");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 07:29 AM
Thanks, but unfortunately, this does not work for 100%. The first sentence is now shown on a new rule, but without blank line/paragraph inbetween the next sentence.
template.print('<p><span style="color: #ffffff; font-family: trebuchet ms, geneva; font-size: 10pt;"><strong>');
template.print(journalEntry.value.replace("\n", "<br/>"));
template.print('</strong></span></p>');