Create an archive rule
The System Archiving application includes several sample archive rules that illustrate the archive features. Related records can be added to an archive rule, and you can view an estimate of the number of records the rule affects.
Before you begin
About this task
Procedure
- Navigate to All > System Archiving > Archive Rules.
- Select New.
-
Fill in the fields as appropriate.
Table 1. Archive Rule form Field Description Name Required. Enter a unique name that identifies the rule. Since this name is the display field for archive rules, references to archive rules display the name you enter here. Table Required. Select the table containing records to archive. - There can only be one archive rule per table (even if the rule is inactive). If there is an existing archive rule for a table, the table no longer appears as an option on the archive rule table list.
- 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]
Active Select this check box to enable the archive rule. Clear the check box to disable the rule. Leave your archive rules inactive until you calculate an estimate of the number of records the rule affects and verify that rule behaves as expected. Retain references Select this check box to keep the sys_id for a reference field instead of storing the display name as a string in the archive table. Important:If you select this option an existing archive rule, newly-archived records store the sys_ids of the referenced records but existing records will still have string values. See Migrating non-reference fields to reference fields.The Retain references check box becomes read-only after you select it and save the archive rule.Description Enter a description of the archive rule. Conditions Select the fields and values that must be true in order for the archive rule to run. Typically, you would archive inactive records older than a certain date. Ensure the correct records are selected by testing the conditions in a list view before you activate the archive rule. For example, the condition [Closed] [before] [Last 2 years] archives records for the current year and the prior year, and not two years ago from today's date. 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].
Auto Rearchive If a record is restored, this enables the record to be automatically rearchived after a set period of time. Auto Rearchive Duration If you set the Auto Rearchive option, you must set a time interval before the restored record is automatically archived. - Select Submit.
-
Calculate the estimated number of records to archive by selecting the
Recalculate Estimate related link.
The updated count appears in the Record estimate field.
What to do next
If you do not want to wait for the scheduled job to run the archive rule, you can manually start the archive rule by clicking Run Archive Now.
Archive related records
Use the Archive Related Records related list to add related records to the archive rule.
Before you begin
Role required: admin.
Procedure
- Navigate to All > System Archiving > Archive Rules.
- Select the appropriate archive rule.
- From the Archive Related Records related list, click New.
-
Fill in the Archive Related Records form.
Table 2. Archive Related Records form Field Description Archive map Displays the archive rule to which the related records apply. Action Select the action you want the archive rule to take on related records. Choices include:- Archive: archive records that reference the archived record.
- Clear: remove the reference to the archived record. The record no longer references the archived record and does not appear as a related record in future archives.
- Delete: delete records that reference the archived record.
Reference Select the relationship of the records you want to apply an action to. The Reference field lists all relations that currently exist for the table being referenced. There are two types of possible relations.
Another table has a reference field calling the archived table. For example, if you are archiving problem records, there is a Problem ID field in the Incident table that references the related problem records.- The Archive action archives the related record in addition to the primary record. For example, if you select the Problem in Incident reference, the related record rule also archives any incident record that references an archived problem.
- The Clear action removes the reference to the primary record. For example, if you select the Problem in Incident reference, the related record rule updates any incident record with a reference to the archived problem record by clearing the reference. If the reference is a many-to-many relationship, the related record rule deletes the reference instead of clearing the reference.
- The Delete action deletes any record that references the primary record. For example, if you select the Problem in Incident reference, the related record rule deletes any incident record that references the archived problem record.
Another table has a Document ID field which might point to the archived table. For example, if you are archiving problem records, there is a sys ID field in the Attachments table that may reference the problem record. The list indicates document ID relationships by displaying an asterisk (*) character at the end of the selection name.- The Archive action updates the Document ID of the related record to point to the archived table. For example, if you select the Table sys ID Attachment(sys_attachment)* reference, the related record rule updates the attachment record to change the Document ID to refer to the archived table record.
- The Clear action removes the Document ID reference to the archived record. The record no longer references the archived record and does not appear as a related record in future archives.
- The Delete action deletes any record that references the primary record. For example, if you select the Table sys ID Attachment(sys_attachment)* reference, the related record rule deletes any attachment record that references the archived primary record.
Note:You can't select references from some internal system tables or from 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]
Reference table Displays the table where the rule looks for related records. Reference element Displays the reference field or Document ID the rule queries for. Reference table rule Select an existing archive rule that applies to the related records you are archiving. For example, if you already have an archive rule for the Incident table, select the existing Incident table rule when archiving records related to incidents records. Note:You control the cascade depth by specifying the archive rule for an archive related record. Related records without a specified archive rule aren't cascaded.- Prior to the Washington DC release, if an archive rule was defined for the table matching a related record's table, the system would automatically cascade and process that archive rule and the related records associated with it.
- Beginning in the Washington DC release, even if an archive rule exists for a related record's table, you must declare that rule in the Reference table rule field to achieve that cascading behavior. If you have multiple related records on multiple tables, you can decide which of those records you want to include in the cascade by defining the reference table rule.
- Click Submit.
Verify the number of records affected
Each archive rule provides an estimate of the number of records the rule affects.
Before you begin
About this task
This 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 and then click the Recalculate Estimate related link.
Procedure
- Navigate to All > System Archiving > Archive Rules.
- Select the archive rule you want to estimate records for.
- Click the Recalculate Estimate related link.
Setting the language of archived strings
On internationalized instances, the archive process uses the language of the SYSTEM user to select the display value strings.
If there is no SYSTEM user, the instance uses the default language setting to select the display value strings. You can either create a SYSTEM user with a specific language setting or set the system default language to select the language of archived strings.