Archive Log Table Records Not being DestroyedDescriptionThis issue is caused due to an invalid null check when adding sys_ids to the tableMap for destroying. This is fixed in Utah Patch 2.Steps to Reproduce 1. Create an archive rule for any table. 2. Run the archive rule and make sure the records are moved from the base table to the ar_ table. 3. Create a destroy rule for this ar_ table. 4. Run the destroy rule. Notice that destroy completes just fine, has the count of the number of records destroyed, and sys_archive_log records are moved to sys_archive_destroy logs. But the records are not deleted from the ar_ table.WorkaroundThe work around for this is to run the below script for the affected ar_ table which will destroy/delete records for that table. The script also makes sure that there is a destroy rule for the ar_ table and the archive_duration is considered in the query while destroying records. Things to change/update as needed: We can update AR_TABLE const to the ar_ table which needs records to be destroyed.The ADD_DAYS const is do a deletion in range based on the sys_created_on and can be changed/updated as seen fit. (function() { const AR_TABLE = 'ar_sys_email'; //The ar_table that needs to cleaned const ADD_DAYS = 7; //No of days to add to the sys_create_on range deletion const SYS_ARCHIVE_DESTROY_RULE = 'sys_archive_destroy'; const SYS_CREATED_ON = 'sys_created_on'; var hasDestroyRule = false; var ad; var minSysCreatedOn; main(); function main() { getDestroyRuleAndArchiveDuration(); getMinSysCreatedOnForArTable(); if (hasDestroyRule && minSysCreatedOn != null) { var startTime = new GlideDateTime('1970-01-01 00:00:00') var adDateTime = new GlideDateTime(ad); var archiveDuration = new GlideDuration(adDateTime.getNumericValue() - startTime.getNumericValue()); var minSysCreatedOn_dt = new GlideDateTime(minSysCreatedOn); var nowMinusDuration = new GlideDateTime(); nowMinusDuration.subtract(archiveDuration); while (minSysCreatedOn_dt.before(nowMinusDuration)) { gs.info(minSysCreatedOn_dt); var startDateTime = minSysCreatedOn_dt.toString(); var endDateTime; minSysCreatedOn_dt.addDays(ADD_DAYS); if (minSysCreatedOn_dt.before(nowMinusDuration)) { endDateTime = minSysCreatedOn_dt.toString(); } else { endDateTime = nowMinusDuration.toString(); } deleteArRecords(startDateTime, endDateTime); } } else { gs.info('Nothing to delete. Exiting..'); } } function getDestroyRuleAndArchiveDuration() { var gr = new GlideRecord(SYS_ARCHIVE_DESTROY_RULE); gr.addQuery('table', AR_TABLE); gr.query(); if (gr.next()) { hasDestroyRule = true; ad = gr.getValue('archive_duration'); } } function getMinSysCreatedOnForArTable() { var ga = new GlideAggregate(AR_TABLE); ga.addAggregate('MIN', 'sys_created_on'); ga.setLimit(1); ga.query(); if (ga.next()) { minSysCreatedOn = ga.getAggregate('MIN', 'sys_created_on'); } else { gs.print('Could not get min sys_created_on'); } } function deleteArRecords(startDate, endDate) { var md = new GlideMultipleDelete(AR_TABLE); md.addQuery(SYS_CREATED_ON, '>=', startDate); md.addQuery(SYS_CREATED_ON, '<', endDate); md.setForceChunking(true);//chunks by 800 records md.setWithThrottler(true); md.setWorkflow(false); md.execute(); } })(); Related Problem: PRB1637481