Aniket Bhanse
Tera Guru

Here is the script for the same

 

You can enter the date as you want, and all the records which are created before that date will be deleted: 

var gr = new GlideRecord('sys_audit_delete');
gr.addEncodedQuery("sys_created_on<javascript&colon;gs.dateGenerate('2023-02-28','00:00:00')); //Enter the date here
gr.query();

gs.info(gr.getRowCount());

while(gr.next()){

gr.deleteRecord();

}

 

If my response helps you in any way, please mark my response as helpful or "Accept as Solution" so that your question will help others as well

Thank you