history line is getting updated with delay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2017 11:10 AM
Hi All,
when we want to query history line table to know what field value has been changed, the table is not getting updated as soon as record is updated. why delay is happening, if yes then how we can check on expected time accurately to update history table.
Regards,
Swamy
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2017 11:47 AM
sys_history_line is not the audit history of a record. It is a cache that gets refreshed by a user in the system looking at a record that has some need to display the history (Such as if the Activity Stream is on the form).
So, you can not query it for changes.
Can you describe the requirement? The audit of a field would be in a sys_audit table, but you shouldn't be running queries against it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2017 05:58 PM
Hi Martin,
Thanks for the reply!
when information updated in incident in one instance then same information should be sent and updated through webservice.
As i want to send only updated field value, i found sys_history_line as the choice. So, i need to understand which script is responsible for adding history into this table and why delay is happening in order to capture the same, is it something a scheduled job which will be queued just like async business rule?
Regards
Swamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 01:34 AM
History Line is built from Audit data (sys_audit). It is not built automatically for every record that gets created. It is usually built when a user views the record.
Take this example:
- I run the following script via Background Scripts:
var gr = new GlideRecord('incident');
gr.initialize();
gr.short_description = "This is a test";
gr.description = "Same test";
gr.insert();
gs.print(gr.sys_id.toString());
I get its sys_id:
*** Script: 33f46344db654b002f2dfa3baf9619c0
So when I go to sys_history_line there is nothing for the new incident I created. I go to Incidents and load the form for the new incident then I see sys_history_line gets populated for this particular incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 02:31 AM
Hi Sergiu,
Thanks for your explanation!
Is there any way through script to trigger that script to work (without actually opening the form).
Regards
Swamy