Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Manually update audit history

davidmcdonald
Kilo Guru

I'm after a way to manually insert an item into a record's audit history for a specific time.

Background on the challenge is that a record was closed in the past, but it didn't save. I can update the record's data manually without triggering workflow & sys_fields being updated (gr.autoSysFields(false) and gr.setWorkflow(false)) but I can't get it to update the audit history / history sets correctly.

I've been able to insert sys_audit records with customised sys_created_on timestamps however whenever I refresh the history set, the audit records are still missing.

Anyone know how to insert audit / history information manually, for a specific time?

1 REPLY 1

ark6
Mega Guru

Hi David,



Try the following



1. Insert the record in the sys_audit table


2. Insert again in the sys_history_set table


3. Insert it in the sys_history_line as well.



Please note that an ACL blocks the updation of the records in the sys_history_line. You need to disable the ACL before doing it.



Do let me know if it helps..