
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2024 11:52 AM
is there a way we could create the history set using a script instead of manually creating it by opening a record.
context: we are trying to retrieve a data from thousands of user profiles and we are querying the history set tables but we saw that not all records have history sets because of which our query does not find anything.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2024 07:09 AM
Hey @Ravish Shetty,
There is way to generate the sys_history_line via GlideHistorySet. You can execute it as given below
new GlideHistorySet(<table name>, <record.sys_id>).generate()
e.g.
new GlideHistorySet("task", task.sys_id).generate();
Original answer was here: Querying sys_history_line
I hope you find this helpful, please mark if so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2024 12:06 PM
@Ravish Shetty please check below and see if helpful.
Please mark my answer correct and helpful if this works for you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2024 05:55 AM - edited ‎12-10-2024 05:57 AM
thanks Gangadhar. this is the exact problem that I am facing but it did not seem like the person got an answer for their query or maybe it is not possible

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2024 07:09 AM
Hey @Ravish Shetty,
There is way to generate the sys_history_line via GlideHistorySet. You can execute it as given below
new GlideHistorySet(<table name>, <record.sys_id>).generate()
e.g.
new GlideHistorySet("task", task.sys_id).generate();
Original answer was here: Querying sys_history_line
I hope you find this helpful, please mark if so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2025 10:34 AM
If you are finding that you are missing the latest sys_history_line records, after you generate using GlideHistorySet there is another function:
new GlideHistorySet(<table name>, <record.sys_id>).refresh()
Which can be used to retrieve/generate the latest sys_history_line's for an existing set.
Hope this helps anyone who stumbles upon this thread