Viewing cmdb record sys_history

maroo
Tera Contributor

Does the sys_history record get created 'on demand'.  Meaning there is a record for the sys_history, but it is not 'active' or 'exists' until you manually go into the cmdb record and view history?

Is there any documentation to explain this?

And any documentation of why users should not use the sys_history_line or sys_history_set for tracking changes of a record?


1 ACCEPTED SOLUTION

Huynh Loc
Mega Sage

Hi @maroo ,

 

Yes — sys_history_set and sys_history_line records are created on demand, not continuously.

Are sys_history records created only when history is viewed?

Yes.
ServiceNow does not permanently store history data in sys_history_set or sys_history_line.

  • When a user opens History → List or views the Activity Formatter for a record, ServiceNow generates a “History Set” on demand
  • The platform derives this data from the permanent audit table (sys_audit)
  • The generated history is then cached in:
    • sys_history_set (the container)
    • sys_history_line (individual change lines)

If no one ever views the history of a record, no history set exists for it.

You can refer links to get more information.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0547662

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0744473

If this response was helpful, please consider marking it as Correct and Helpful. You may mark more than one reply as an accepted solution

View solution in original post

3 REPLIES 3

marthastolp
Tera Contributor

Unfortunately, the field changes are not tracked before auditing has been turned on.  It could be that some fields have already been activated OOTB, but unless that has been done, there is no audit trail. Here's a short explanation of the History/Audit tables: 

https://www.servicenow.com/community/developer-forum/what-data-does-sys-history-line-sys-history-set...

 

Although I can't find documentation on it at the moment, here are some best practices I'd recommend when setting up auditing for a table:

  • Avoid auditing frequently changing values, especially if there is no use case for them
    • The sys_audit/sys_history tables tend to grow exponentially
  • Don't audit the entire table
    • Focus on fields that are important for auditing or drive decision-making
  • Check the company's regulations regarding auditing specific fields
  • If not already set up, make sure these tables have a "cleaning" schedule

Hope this helps!

Huynh Loc
Mega Sage

Hi @maroo ,

 

Yes — sys_history_set and sys_history_line records are created on demand, not continuously.

Are sys_history records created only when history is viewed?

Yes.
ServiceNow does not permanently store history data in sys_history_set or sys_history_line.

  • When a user opens History → List or views the Activity Formatter for a record, ServiceNow generates a “History Set” on demand
  • The platform derives this data from the permanent audit table (sys_audit)
  • The generated history is then cached in:
    • sys_history_set (the container)
    • sys_history_line (individual change lines)

If no one ever views the history of a record, no history set exists for it.

You can refer links to get more information.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0547662

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0744473

If this response was helpful, please consider marking it as Correct and Helpful. You may mark more than one reply as an accepted solution

maroo
Tera Contributor

Thank you @Huynh Loc

Mega Sage