- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2019 07:31 AM
Hi all,
I'm trying to create what is effectively a custom log, that records updates to particular fields on records of a particular type. I'm fine with creating entries for the log for future updates to records - I have a business rule that reponds to updates to the fields of interest and creates an entry on the log.
I wanted to create 'historic' logs based on updates that have already happened. I have a script that 'scans' the sys_history_line table for the records, finds the relevant updates and then creates the log entries. However, I'm finding that sys_history_line can only be queried for a particular record if the record itself has recently been opened. So I'm guessing the entries on the sys_history_line table are somehow created 'on-the-fly' whenever a record is viewed. Is there a way to 'mimic' this, so that entries on sys_history_line relating to particular records become available to a GlideRecord query in a script?
I guess if not, I would have to query the sys_audit table.
Thanks
Jamie
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2019 10:29 PM
Hi Jamie,
There is way to generate the sys_history_lina 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();
Best regards,
Boyan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2019 10:29 PM
Hi Jamie,
There is way to generate the sys_history_lina 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();
Best regards,
Boyan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2019 01:11 PM