---
sourceDocument: Xanadu ServiceNow AI Platform Administration
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/platform-administration

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu ServiceNow AI Platform Administration

ft:clusterId :

    - platadm

bundleId :

    - platadm

workflow :

    - Platform


---

# Create a table cleanup rule

# Create a table cleanup rule {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

Define the criteria for deleting unwanted records in a table cleanup rule.

## Before you begin

Role required: admin

## Procedure

1. Navigate to AllData Management Policies.
2. Select the data management policy for the table that contains the records you want to delete.  
   If the table doesn't have a data management policy record, create one. See [Create a data management policy](https://servicenow-prod.fluidtopics.net/3~Th~43AbLLTisDDV_pFPA "Define a set of rules for managing the data in a table on your instance.").
3. In the Table Cleanup Rules related list, select New.
4. On the form, fill in the fields.  
   {#activate-table-cleanup__table_tn5_rbr_ktb__entry__2}

   | Field | Description\` |
   |-|-|
   | Tablename | The name of the target table. |
   | Matchfield | The Date/Time field in the target table that is used to monitor duration. Defaults to sys_created_on, which deletes records based on the amount of time since their creation date. |
   | Age in seconds | The amount of time the system waits before deleting records. When the Matchfield value becomes older than the Age in seconds, the record is deleted. |
   | Active | Option to activate or deactivate table cleaning for this table. |
   | Application | The application scope to which this table cleaner job applies. |
   | Clean attachments and journals | If selected, related records in the Journal Entry \[sys_journal_field\] table are also deleted. If cleared, the system deletes records from the target table, but not any related journal records in this table. Note: Although attachments are mentioned in the label, this option only applies to journal records. |
   | Clean audit | If selected, related records in these audit tables are also deleted: * Sys Audit \[sys_audit\] table * Audit Relationship Change \[sys_audit_relation\] table {#activate-table-cleanup__ul_szv_fxh_4xb} Note that the audit records that are created by table cleaner in the Audit Deleted Record \[sys_audit_delete\] table are preserved. If cleared, the system deletes records from the target table, but not any related audit records in these tables. |
   | Cascade delete | If selected, this option deletes all matching records plus any records referring to them. If cleared, the system deletes matching records, but not records referring to them. |
   | Conditions | Condition builder for specifying filter conditions that define the records to be removed. For example, you might specify that only records where 'active = false AND state =closed' are deleted. |
   [Table 1. Auto Flush form]

   {#activate-table-cleanup__table_tn5_rbr_ktb}
5. Select Submit.

## Result

Table cleaner runs automatically and deletes records when they meet the specified
record age and any conditions that you set for them.

*[\>]: and then


