User Tools

Site Tools


snc_comment_handling

ServiceNow Comment Handling

For the most part your interaction with comments in ServiceNow has been through the activity log on the form view of a record. However, the handling for comments has a lot of moving parts to it. This article will cover those pieces and how they play a role in what you see.

Record to Journal Fields

ServiceNow supports comments by storing the comments in the Journal Fields [sys_journal_field] table. When you make a comment, that comment is then loaded into the Journal Fields table. This table will note down the content, table, base record, and type (work_note/comment) of the comment.

A small, but important, detail of this is that when you are making a comment on a record, that comment is “embedded” in the record.

  • Prior to the update occurring this comment is stored on the record's [comments] column or [work_notes] column
  • During the update this comment is stripped from the record and loaded into the Journal Field and Audit Table
  • After the update the record's [comments] column is empty.

If you are familiar with Business Rules in ServiceNow this will partially dictate how the comments are replicated.

When you pull up the record the Activity Log is drawn from this record's Journal Fields and Audit Log (more details below).

Implementation

How you decide to replicate comments will vary slightly depending on what you want to accomplish.

ServiceNow to Database

If you are replicating from ServiceNow to Database than you will want to use our “Include Journal Fields” checkbox on the form of the Bulk Share or Dynamic Share. If you are using a Dynamic Share you will want to set your “Business Rule When” to “After”, since the Journal Fields will be created “After” the update has occurred.

This will send you the comments as individual records that you can then look up and link to the record in your Journal Fields [sys_journal_field] table in your Database.

ServiceNow to ServiceNow / SIAM

If you are replicating comments between ServiceNow instances and/or through one of our SIAM integrations than you will want to send the comments through the embedded record. This means that you will NOT be using “Include Journal Field”. Instead you will set your “Business Rule When” to “Before”. The comment will be embedded in the record update and sent across. The Subscribing instance will then utilize that and generate the comment itself.

If you have both “Business Rule When” set to “Before” and “Include Journal Fields” checked than you may end up creating duplicate comments on the Subscribing instance. As you are both:

  • Sending the comment embedded in the record and letting the Subscribing instance generate the comment
  • Sending a comment record “directly” and having the instance store that comment

Activity Log & History Set

History Set

When you are looking at the Activity Log of a record in ServiceNow you are looking at the History Set [sys_history_set] of that record. ServiceNow has some good documentation on these, for starters:

As a summary ServiceNow has the History Set of records which have been modified or accessed recently. These will be generated dynamically and cleaned up after a period time of no one accessing or modifying the base record. This is so the Activity Log can draw from this table quickly as opposed to querying the audit and journal field table every time a user loads the form.

Additionally a History Set will be generated for each domain (as necessary) when accessing a record. So you may see a different History Set in the /TOP domain versus the /TOP/Standard/ACME domain. In general though, they should be the same.

History Set Generation

Earlier you read that the Activity Log was generated from from the Journal Fields. This is a bit of a simplification. In reality the full process is:

  1. A comment is made and embedded on the record
  2. The record is updated
  3. The embedded comment is moved into the comment tables
  4. A Journal Field record is created AND an Audit record is generated for this comment
  5. The History Set is updated from the latest Journal and Audit data
  6. Your form reloads and pulls up the latest History Set for its Activity Log

So the History Set is generated dynamically by the Audit and Journal Field records.

snc_comment_handling.txt · Last modified: 2018/06/11 16:45 by jackson.davenport