Service Now - Audited Table Report

Thursday Jan 9, 2020

Code

Here’s the code:

var gr = new GlideRecord('sys_audit');
gr.addQuery('tablename', 'mytablename');
gr.orderBy("documentkey");
gr.query();
var counter = 0;
while(gr.next() && counter < 2){
  gs.debug(gr.getValue("documentkey") + ": " + gr.getValue("fieldname") + " was [" + gr.getValue('oldvalue') + "] is [" + gr.getValue('newvalue') + "]");
  counter = counter + 1;
}