How to request sys_audit_delete table ?

thibautdeflandr
ServiceNow Employee
ServiceNow Employee

Hi guys,

I would like to make a query on sys_audit_delete table but apparently it's not possible, indeed i always got a isValidRecord == false.

my code:

var myRecord = new GlideRecord('sys_audit_delete');

myRecord.addQuery('tablename', 'incident');

myRecord.addQuery('documentkey', 'myexistingdocumentkey');

myRecord.query();

gs.addInfoMessage(myRecord.isValidRecord()); //false

Also i can't access to this table through the rest API explorer.

Do you know why ? and if there is a possibility to access to the record (only read) of this table in a script include ?

Thanks a lot.

1 ACCEPTED SOLUTION

vinothkumar
Tera Guru

Hi Thibaut,



Try something similar as below and it worked. just changed the table name and document key and it is returning true. Can you check it



var myRecord = new GlideRecord('sys_audit_delete');  


myRecord.addQuery('tablename', 'u_vp_task_relationship');  


myRecord.addQuery('documentkey', 'a2ba47bbdb304700566cfe18bf96193e');  


myRecord.query();


if(myRecord.next())


{


gs.addInfoMessage(myRecord.isValidRecord()); //false


}


View solution in original post

5 REPLIES 5

It's works, i had already try that but maybe another thing was causing an error.


Thanks,