Finding old value of a field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2017 06:12 AM
I have a requirement to pull the old value of a filed which was updated on a particular date. Tried to query the sys_audit table but transactions are failing. What is the best option to do this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2017 06:23 AM
If the field is not audited, the only other way I know of at this time to get the old value would have been with a business rule at the time of change. The value in the table has been overwritten and at this point may not be retrievable.
Nate Aiken
Senior Solution Architect
Evergreen: IT that aims higher
PS: Please hit Like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2017 06:32 AM
Hi Sam,
2 options you can try:
- Change the Quota Rule for UI Transactions: Default quota rules
- When you open up the sys_audit table, wait until you get the transactions failing message appears again and immediately afterwards try again. Some caching will be applied which might open up the list of audit records quicker (often in my case but not always).
But as Nate already pointed out, make sure first the table is being audited (can be done by checking the "collection" record of the table in the System Dictionary); otherwise no activities will be kept in the platform for the specifc table records.
Hope this helps you forward,
Stijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2017 06:35 AM
Thank you. The field is being audited. I will try the sys_audit table again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2017 06:44 AM
Sam,
forgot another option...
You can also apply this script to retrieve all of the changes for a given field on a particular record. It can be executed by going to the module "Scripts - Background" in the platform (as long as you're an administrator). Just don't foget to fill in the query data highlighted by <...> within the code:
// *** START OF CODE ***
var auditRec = new GlideRecord('sys_audit');
auditRec.addQuery('documentkey', '<SYS ID of the record>');
auditRec.addQuery('tablename', '<table name of the record>');
auditRec.addQuery('fieldname', '<field name>');
auditRec.query();
while (auditRec.next()) {
gs.print("Value changed from " + auditRec.oldvalue + " to " + auditRec.newvalue + " on " + auditRec.sys_created_on);
}
// *** END OF CODE ***
Kind regards,
Stijn