Data in Audit history does not show up on any audit-enabled record

tahnalos
Kilo Sage

Hey guys

I recently activated auditing on a table that I have been working on and have enabled audit tabs on the record.   Now I know that the audit is working as it is saving audit data as seen in the sys_audit table, but it isn't showing up on the record's auditing history.   If I log in as an admin, and press refresh on audit history, the history does show up for the ticket, and the non-admin user can now see it as well.

I was told there was supposed to be a process to attach audit history to the record and that it may not be working.   Can anyone clarify this or shed some light as to why the audit history is not refreshing?

Thanks

Eric Chow

4 REPLIES 4

tahnalos
Kilo Sage

Just saw this in the log while trying to replicate.   Could this be stopping processing of audit logs?



org.mozilla.javascript.EcmaError: Cannot convert null to an object.


  Caused by error in <refname> at line 1



==> 1: gs.hasRole("admin") && RP.isRelatedList() && parent.getTableName() != 'sys_history_set'



Thanks


tahnalos
Kilo Sage

Ok, I have determined that the refresh was supposed to be handled in a UI action called refresh that fires using the History table (sys_history_line).   It is active, show insert and show update is on, list banner button is activated.



Condition is gs.hasRole("admin") && RP.isRelatedList() && parent.getTableName() != 'sys_history_set'



Script is:



var uri = action.getGlideURI();


var table = uri.get('sysparm_collection');


var id = uri.get('sysparm_collectionID');


new GlideHistorySet(table, id).refresh();


gs.addInfoMessage(gs.getMessage("History has been refreshed"));


uri.set("sys_id", id);


action.setRedirectURL(uri.toString(table + ".do"));



Curiously, this works fine on change_request but does not work on change_task.   Likewise, if I press the refresh button on Audit History, it works as well.   Why is the error happening?


tahnalos
Kilo Sage

Some more tests about the audit history: if a user right clicks on the form's header, and selects History->Calendar or History->List (only admins have that one), it automatically refreshes the audit history in the record.   This is a workaround but not the solution, and the client prefers this to be done automatically.   Given what I have investigated, it looks like something is killing the refresh of Audit history on this particular table but don't know what could be causing it.



Anyone have any ideas?



Thanks


I've seen a problem before where RP was undefined when it was evaluating the conditions field.