Show the first responder of the ticket using the sys_history_line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 05:17 PM - edited 09-04-2023 08:41 PM
Hi,
I have a requirement to show who moved the ticket from New. I have created a new field, u_first_responder. If a user changes the state from New to any state, user's name should appear in the field. I also created a BR with the following script but I cant seem to populate the first responder field.
When: before
Script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 09:02 PM
Hi @Rairai31
the table sys_history_line cannot be used for this purpose as its contents are generated automatically only in case a user opens a record form. The reason is to speed up the overall process as extracting the data from the sys_audit table would take too long.
But there is a better approach using the HistoryWalker API. See the following post for more information: https://developer.servicenow.com/blog.do?p=/post/historywalker/
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 09:28 PM
Hi there,
As Maik already mentioned, using the sys_history_set and sys_history_line tables for this is not a good usage. It might work for a few records if someone already triggered the generation of these, those for most records... there won't be any sys_history_set and sys_history_line present.
I do wonder though, why would you query such a table? This is about populating a custom field with a certain value? Why not populate that value upon when the state of the record is changed immediately? Than you can just populate that field immediately with whom, instead of quering other tables or using an API or whatever. Sounds unnecessary.
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
09-18-2023 11:00 PM
I appreciate all your responses. Yes, I was looking the other way around. Thank you very much.