Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
On UI16, invalid HTML code added with [code] element to journal fields entries appears blank and produces error message - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • On UI16, invalid HTML code added with [code] element to journal fields entries appears blank and produces error message
KB0621651

On UI16, invalid HTML code added with [code] element to journal fields entries appears blank and produces error message


2128 Views Last updated : Apr 7, 2024 public Copy Permalink
KB Summary by Now Assist

Description

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.

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

    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] http://errors.angularjs.org/1.4.8/$sanitize/badparse?p0=%3Cp%20align%3D%22center%22style%3D%22%22%3ETag%20attributes%20have%20no%20space%3C/p%3E

    Error: [$sanitize:badparse]

 

Workaround

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 glide.ui.security.allow_codetag 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 -----
    gs.print(addspacesmissingonhtmltags(
        '<a href="https://www.google.com"target="hello"stuff="things" omg="wow">stuff " and things" </a>'
    ));

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

    Result:

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


Related Problem: PRB660886

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.