dylan_lindgren
ServiceNow Employee

Most fields in ServiceNow store a single inputted text value. To view previous values one needs to go into the record's audit history. Journal fields are different, in that all previous values of this field are shown as distinct posts within the Activity Stream timeline. This allows them to be used as a method of communication with users and coworkers about the current record, and also as a log of the history of the record.

 

With journal fields, the content of notifications are commonly based on the newly updated value of the journal fields, and that they only accept input as plain-text. Out of box, there are two journal fields on the task table:

 

  • Additional comments [comments]
  • Work notes [work_notes]

 

Adding HTML code in Journal fields

As with most fields, if the new value contains HTML code it is escaped. For example, if you were to type the below valid HTML code in a journal field:

html code journal fields.jpg

It would appear in the Activity Stream as follows:

INC0010056___ServiceNow.png

The way this is done is by replacing any characters in a journal field that could be interpreted by a browser as HTML with it's HTML entity code.

 

For example, HTML tags make use of < and > to declare the start and end of a tag. ServiceNow replaces these with their HTML entity code &lt; (less than) and &gt; (greater than), meaning that when the browser reads the code it doesn't get processed as a literal < and >, and therefore does not mistakenly become a HTML element.

 

Using the [code] tag in Journal Fields

Text wrapped in [code] tags bypasses the escaping process described above, and will instead be rendered as HTML. For example, the same input used above, but wrapped in [code] tags:

INC0010056___ServiceNow.png

Will appear in the Activity Stream as follows:

INC0010056___ServiceNow.png

Note that the <blockquote> tags are now being interpreted as HTML elements, and are not being escaped. Also note that you can use multiple sets of [code] tags within a single journal entry.

 

Formatting styles in Journal entries

There are a number of HTML elements that you can use to add styles to your journal updates. Some examples are shown below:

 

Style
Tag(s)
Example Journal Entry
Italic <em> [code]This text is <em>italic</em>[/code]

INC0010056___ServiceNow.png

Strikethrough <strike> [code]This text is <strike>strikethrough</strike>[/code]
INC0010056___ServiceNow.png
Code (inline) <code> [code]Check the script include <code>KBKnowledgeBase</code>[/code]

INC0010056___ServiceNow.png

Code (block) <pre><code>

[code]<pre><code>function foo() {<br/>

      console.log('bar');<br/>

}</code></pre>[/code]

INC0010056___ServiceNow.png
Blockquote <blockquote> [code]<blockquote>This is a quote</blockquote>[/code]
INC0010056___ServiceNow.png
Hyperlink <a> [code]<a href="https://www.servicenow.com">ServiceNow.com</a>[/code]
INC0010056___ServiceNow.png
Bullet points <ul><li> [code]<ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>[/code]
INC0010056___ServiceNow.png
Numbered lists <ol><li> [code]<ol><li>Item 1</li><li>Item 2</li><li>Item 3</li></ol>[/code]
INC0010056___ServiceNow.png
Header <h3> [code]<h3>This is a header</h3>This is normal.[/code]
INC0010056___ServiceNow.png

 

The HTML elements shown above do not contain any styling information - that is left up to ServiceNow's CSS stylesheets, and the browser's user agent stylesheet. Therefore, as the styles rely on ServiceNow CSS, the way they are presented to users may change after future user interface upgrades.

 

The above examples show how the HTML elements are displayed in the Istanbul release of ServiceNow, running UI16. See kobby.adu-nti demo in Formatting the Journal Field with the [code] tag

48 Comments
clandons1
Kilo Explorer

I don't understand why ServiceNOW just doesn't offer the ability to chose in these journal entries?

We need to paste a lot of formatted output to work notes such as router snapshots, code, etc.. having to wrap it in HTML code is just not efficient. 

premer
Giga Expert

If you use the Agent Workspace environment, you can change the glide.ui.journal.use_html sys_property to true. This will cause the journal and input field to become rich text. Only in the Agent workspace environment though, not in the "regular" forms.

Nick Lamb
Giga Contributor

This thread really speaks to the need for Markdown (with preview) or something similar in case commenting, KB and throughout the platform. I've filed an Idea for this, that's linked here: Markdown for Case/Task Comments, KB Articles and Community.

This has been my single biggest frustration with the platform thus far.

Adrien7
Giga Contributor

Great post Dylan, it helps me a lot!

I'm trying to apply the same concept on the visual task board, the idea is to display a URL link directly on the card for the user to open the associated document (sored in Sharepoint).

But for some reason, I can't make it work, any suggestions?

thanks in advance for you hep

Adrien

find_real_file.png

Kim Sullivan
Tera Guru

Would this also work in the description fields?  Would be great to see hyperlinks there.

Vasanth14
Kilo Contributor

Hi,

Your html code should be within [code]  <html code block > [/code].

From your screenshot, you are missing "/" in the end [/code] tag.

Uncle Rob
Kilo Patron

Your new name is hawkeye

srinathgtrk
Tera Contributor

HI Everyone,

 

How to support tabular format at worknotes? above like this

 

SNONameEmp nopercentage
1Raj2480
2san2590
akhila13
Tera Expert

Hi All,

We have enabled the property  glide.ui.journal.use_html to change journel  field to HTML.

 

While doing so its having limited feature

akhila13_0-1685109737864.png

 

 

but HTML Field have more features  as higlighted.

akhila13_1-1685109737868.png

 

 

 

is it possible to add more features.I dont want to change the type to HTML

AndersonHenriqu
Tera Contributor

I believe this no longer works, because I tried it and it did not work at all.