Invalid HTML code added with the [code] element to journal fields (sys_journal_field, sys_history_line) produce entries the display as blank and produce the Angular error Error: [$sanitize:badparse].

Steps to Reproduce

  1. On UI16+, navigate to Incident > Open and select an incident.

  2. Add invalid HTML text using [code] ... [/code] tags to a Work notes field.

    For example, copy the following text and click Update.

    <p align="center"style="">Tag attributes have no space between them</p>

    Note – Do not include a space between "center" and "style."

    Note that a blank comment or Work note is added and the JavaScript console displays the following message:

    Error: [$sanitize:badparse]$sanitize/badparse?p0=%3Cp%20align%3D%22center%22style%3D%22%22%3ETag%20attributes%20have%20no%20space%3C/p%3E

    Error: [$sanitize:badparse]



Ensure that the HTML tags that are added using [code]... [/code] are valid on journal fields

Several workarounds are available:

  • Instead of using the [code] tag, use the text version or strip the text from the HTML instead.

  • Switch to UI15.

  • Make the code tag visible by setting the system property to false.

  • Create scripts to fix the malformed HTML, for example, using regular expressions. The following example applies to the test case:

    --background script -----
        '<a href=""target="hello"stuff="things" omg="wow">stuff " and things" </a>'

    function addspacesmissingonhtmltags(a) {
        return a.replace(/(\B"\w+[^"]*")/g, "$& ")
    --background script -----


    [0:00:00.004] Script completed in scope global: script
    *** Script: <a href="" target="hello" stuff="things"  omg="wow" >stuff " and things" </a>

Related Problem: PRB660886

Seen In

Geneva Patch 1 Hot Fix 5
Helsinki Patch 2

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-05-21 11:34:17