How to access "new" column in sys_history_line?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 06:43 AM
There is an OOB field named "new" on sys_history_line. When you try to glidequery to the record and print rec.new you get an error "Compiler exception: missing name after .".
How do I access this field value?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 06:55 AM
Hi there,
Just out of curiousity, what's the business case to query sys_history_line table? Just asking because often (9 out of 10 times) people are not aware how this table is actually populated and that this is the wrong table for their business case.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 06:58 AM
There is a specific journal field on this table we need to pull in all of the logs for (where we can display the timestamp, the user, and the "new" value) inside a custom section we have in UI builder.
We need to apply formatting around these separate data fields rather than just pulling from record.work_notes which contains everything all mixed together, so we want to pull directly from the source where the fields are separted.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 08:42 AM
You can just use _new as I mentioned in the other reply. So with that this question should be resolved 😀
Why asking for the use case, because you do need to be aware how the data in sys_history_set and sys_history_line are populated and when it is being cleaned up. As this data is only generated when someone manually views the history of a record. So if you would use this for reporting purposes... you might end up with completely incorrect results. Also out-of-the-box there is a Table Cleaner which cleans up this data after a certain amount of time.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 06:57 AM
Regarding your code itself, try:
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field