How to delete selected sys_history_line records but not all audit entries?
This content was last updated in 2023. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2023 06:36 AM
We have a couple of custom fields we're disabling audit for, and want to delete the historical audit entries for these fields only - not all audit records for the table.
Querying sys_history_line to identify the records by field name/table doesn't work because I haven't accessed these records before (i.e. History line does not show results when trying to ... - ServiceNow Community).
Is there any way we can get around the above challenge with a script?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2023 08:31 AM
Hi Anurag,
Thanks for sharing. I can see if I directly query the sys_audit table I always get results, so will explore this further.
Natalie.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2023 01:13 PM
Hi,
You can delete those fields from sys_audit.