---
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 an archive rule

# Create an archive rule {#ariaid-title1}

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

Define the criteria for archiving records by creating an archive rule.

## Before you begin

Because you can define multiple archive rules for a table, verify any existing archive rules to avoid potential conflicts. For example, if there's a rule for archiving records older than six months, creating another rule to
archive records older than three months could cause a conflict. In such cases, either rule could potentially run, each archiving records under different conditions.

Role required: admin

## Procedure

1. Access the archive rule form in one of the following ways.

   | Option | Steps |
   | Using a data management policy | 1. Navigate to AllSystem Data ManagementData Management Policies. 2. Select the data management policy for the table with records that you want to archive. 3. In the Archive Rules related list, select New. {#t_CreateAnArchiveRule__ol_pnw_njk_1bc} |
   | Using the Archive Rules module | 1. Navigate to AllSystem ArchivingArchive Rules. 2. Select New. {#t_CreateAnArchiveRule__ol_f5v_2kk_1bc} |
   |-|-|

   {#t_CreateAnArchiveRule__choicetable_bxv_hjk_1bc}
2. On the form, fill in the fields.  
   {#t_CreateAnArchiveRule__table_ub4_f4s_x4__entry__2}

   | Field | Description |
   |-|-|
   | Name | Name that identifies the rule. Used as the [display value](https://servicenow-prod.fluidtopics.net/RPFd29E0gJ~5OjgjipC~uQ "Reference fields store a sys_id for each referenced record in the database, but the sys_id is not shown.") for references to this archive rule. |
   | Table | The table with records that you want to archive. * You can't change the table in an existing archive rule. To archive records in a different table, create a new archive rule. * You can't select a table in a different application scope. * You can't create an archive rule for a table where update_synch is set to true in the dictionary entry for the table. * You can't create archive rules for some internal system tables or peripheral tables. For example: * Sys Audit \[sys_audit\] * Audit Deleted Record \[sys_audit_delete\] * Audit Relationship Change \[sys_audit_relation\] * Attachment \[sys_attachment\] * Journal Entry \[sys_journal_field\] {#t_CreateAnArchiveRule__ul_g2w_btc_kxb} {#t_CreateAnArchiveRule__ul_l5s_xpc_kxb} |
   | Retain references | Option to keep the sys_id for a reference field instead of storing the display name as a string in the archive table. Important: The Retain references check box becomes read only after you select it and save the archive rule. When you enable this option on a table with archived records, the system automatically reprocesses all existing archive records and enables references. This process can take time to complete for larger archive tables. You can track the status by viewing the Archive Rule Reference Migrations \[sys_archive_ref_migration\] table. For details on manually retaining references, see [Migrating non-reference fields to reference fields](https://servicenow-prod.fluidtopics.net/MsvivueeSRgzvL6DASd8AA "Manually preserve sys_ids in reference fields instead of storing the display name as a string."). |
   | Description | Description of the archive rule. |
   | Conditions | Condition builder for specifying filter conditions that define the records to be archived. For example, you might archive inactive records older than a certain date. Make sure that the correct records are selected by testing the conditions in a list view before you activate the archive rule. For example, * To archive records closed more than two years ago from today, use the relative operator in a condition like \[Closed\] \[relative\] \[before\] \[2\] \[Years\] \[ago\]. * To archive records for the current year and the prior year, and not two years ago from today's date, use a condition like \[Closed\] \[before\] \[Last 2 years\]. {#t_CreateAnArchiveRule__ul_pnz_hjx_1bc} |
   | Auto Rearchive | Option that enables a restored record to be automatically rearchived after a set time period. |
   | Auto Rearchive Duration | The time interval before the restored record is automatically archived. |
   [Table 1. Archive Rule form]

   {#t_CreateAnArchiveRule__table_ub4_f4s_x4}
3. **Optional:** Estimate the number of records to archive by selecting the Recalculate Archive Estimate related link.  
   The estimate only includes primary records and excludes any related records added to the archive rule. The estimate helps you determine if the archive rule affects the number of records you expect it to. If the estimate is too high or low, change the archive rule conditions accordingly.  
   The updated count appears in the Record estimate field.
4. Select Submit.
{#t_CreateAnArchiveRule__steps_gqg_nfg_h1c}

## Activate an archive rule {#ariaid-title2}

Preview the records that you want to archive, and then activate an archive rule.

### Before you begin

Role required: admin

### About this task

You must activate the archive rule and its corresponding data management policy for the archive rule to run.

The sample archive rules are inactive by default.

### Procedure

1. Access the archive rule that you want to activate in one of the following ways.

   | Option | Steps |
   | Using a data management policy | 1. Navigate to AllSystem Data ManagementData Management Policies. 2. Select the data management policy for the table with records that you want to archive. 3. In the Archive Rules related list, select the archive rule that you want to activate. {#activate-archive-rule__ol_wn2_qkk_1bc} |
   | Using the Archive Rules module | 1. Navigate to AllSystem ArchivingArchive Rules. 2. Select the archive rule that you want to activate. {#activate-archive-rule__ol_sk1_vkk_1bc} |
   |-|-|

   {#activate-archive-rule__choicetable_cxh_nkk_1bc}
2. **Optional:** Estimate the number of archive records by selecting the Recalculate Archive Estimate related link.  
   The estimate only includes primary records and excludes any related records added to the archive rule. The estimate helps you determine if the archive rule affects the number of records that you expect. If the estimate is too high or low, change the archive rule conditions accordingly.  
   The updated count appears in the Record estimate field.
3. Activate the archive rule by selecting the Active check box.
4. **Optional:** Archive records immediately by selecting the Run Archive Now related link.  
   The Run Archive Now related link is only available if the corresponding data management policy is activated.

### Result

Records that meet the archive rule criteria are archived during the next archive run.

### What to do next

View the archived records by navigating to AllSystem ArchivingArchive Tables and selecting the module for the archived table, for example, Archive Incidents.

## Create a destroy rule {#ariaid-title3}

Delete archived records and related records after a specified amount of time.

### Before you begin

Role required: admin

### About this task

You can associate a destroy rule with any archive rule in a data management policy.

If you need to amend the destroy rule properties running against your archived data, see [Archive rule and destroy rule properties](https://servicenow-prod.fluidtopics.net/T29H7BHOrh9kx7RpDbcuew "Rules to prevent the archive process from consuming too many system resources have been automated. You can manually change the system behavior.").

### Procedure

1. On the archive rule form, select Create Destroy Rule.
2. In the Destroy Rule tab, fill out the fields.  
   {#t_CreateADestructionRule__table_ugn_bg5_cv__entry__2}

   | Field | Description |
   |-|-|
   | Active | Option to activate the destroy rule. |
   | Destroy Related Records | Option to automatically destroy related records associated with the archived records. Note: Peripheral records, which include records in the Journal Entry \[sys_journal_field\], Attachment \[sys_attachment\], and Sys Audit \[sys_audit\] tables are deleted automatically, even if you decide to preserve related records. |
   | Archive Duration | Specify the amount of time that records stay in the archive table before the system deletes them. |
   [ ]

   {#t_CreateADestructionRule__table_ugn_bg5_cv}
3. **Optional:** Estimate the number of archived records marked for deletion by selecting the Recalculate Destroy Estimate related link.
4. Select Submit.
{#t_CreateADestructionRule__steps_srg_nfg_h1c}

### Result

Records that have been archived longer than the archive duration value are destroyed when the scheduled job runs. You can verify the progress by checking the archive destroy log.

*[\>]: and then


