HTML ordered list <ol> in work notes gets rendered to <ul> in email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2017 02:05 PM
We have a nagging problem with the way HTML gets rendered into emails.
We create an HTML ordered list within a work note on a ticket/task record. (We use an HTML field for work notes, then push it into the work_notes field.) The work note gets stored in a journal field looking something like this:
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
All looks good at this point. It looks exactly as expected within the sys_journal record, and it renders correctly in the GUI. We then fire off an email notification that sends out all new work notes to everyone within the work notes list. All the HTML seems to render correctly with the exception that any order lists get changed to un-ordered lists (i.e.; bullets). The HTML for the above example, when rendered into the email, would look like this:
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
Note how the "ol" gets changed to "ul". By looking at the sys_email records, we've confirmed that this conversion happens before the email is sent out to our email server. The conversion from OL to UL is therefore taking place within ServiceNow.
Has anyone else seen this behavior? If so, is there a way to preserve the list type?
Thanks,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2017 02:25 PM
FYI: I was able to answer my own question.
The problem was that I was using a Notification Email Script, and I had inadvertently checked the "Newlines to HTML" flag. This caused the rendering engine to replace each hard line-return with a set of DIV tags. The original email had hard line returns between each LI element, so a bunch of DIV tags interfered with the flow of the OL elements. The result was ugly HTML.
Un-checking the "Newlines to HTML" seems to have cleared up the problem.
-Dan