Implement Data Retention Policies using ServiceNow System Data Management

SaiAashishN
Tera Contributor

The archive and deletion rules defined below should be implemented using ServiceNow System Data Management (And these rules should be applied to the particular Service Catalog Item)
features.

Default policy
- Records older than 3 years are moved to an archive backup table. These records are accessible for
- Records older than 7 years are permanently deleted
Note: Once delete these records are destroyed permanently from the system and no longer recoverable.
Tables that are excluded from Archive/Deletion policies
- The following types of tables NEVER have archive OR deletion rules
- Any table that is considered a "lookup", "type" or Choice value
- Any User Account records (e.g. from sys_user table)
- Any security related table (e.g. Groups, Roles, etc.)
- Any ServiceNow system table (e.g. "sys_" prefix) that does not already have an Out of box archive or deletion rule

Any suggestions please let me know
 
7 REPLIES 7

@suraj sengar 
This guide outlines how to automate the archival of Service Catalog records by ensuring an entire Request hierarchy is only flagged if the parent is older than 3 years and all child records are inactive.

Firstly, I created a custom field ready to archive on the Request Table and the type is True/False.

Step 1: Create the Script Include

The Script Include validates the status of the entire record tree (Parent Request, RITMs, and Tasks) before flagging.

  1. Navigate to System Definition > Script Includes.

  2. Name: CustomArchiveUtility (or your preferred name).

  3. Logic Overview: * Query the Request [sc_request] table for records opened more than 3 years ago.

    • Check all related Requested Items [sc_req_item] to ensure active is false.

    • Check all related Catalog Tasks [sc_task] to ensure active is false.

    • If the entire hierarchy is inactive, set the custom field u_ready_to_archive to true.


Step 2: Create the Scheduled Job

This job triggers the archival logic on a recurring basis to update the "Ready to archive" flags.

  1. Navigate to System Definition > Scheduled Jobs.

  2. Select Automatically run a script of your choosing.

  3. Name: Daily Archive Flagging Process.

  4. Run: Daily.

  5. Script: Invoke the function from your Script Include


Step 3: Configure the Archive Rule

This moves the flagged data from the live tables to the archive tables.

  1. Navigate to Data Management > Archive Rules.

  2. Table: Request [sc_request].

  3. Conditions: Ready to archive [u_ready_to_archive] | is | True.

  4. Related Records: In the Archive Related Records related list, add:

    • Requested Item [sc_req_item]

    • Catalog Task [sc_task]

  5. Set the rule to Active.


Step 4: Configure the Destroy Rule

This defines the final data purge from the archive tables.

  1. Navigate to Data Management > Destroy Rules.

  2. Name: Standard 4-Year Purge.

  3. Archive Rule: Select the Archive Rule created in Step 3.

  4. Type: Scheduled.

  5. Duration: Set to 4 Years (1460 days).

    • Note: This ensures data is purged 4 years after it enters the archive, totaling a 7-year lifecycle from the record's creation.

  6. Set the rule to Active.

SaiAashishN
Tera Contributor

But I need to get the same output using ServiceNow System Data Management
Is the same possible using the System Data Management

 @SaiAashishN - Yes , what you’ve described can be implemented using ServiceNow’s System Data Management (SDM). SDM is designed exactly for defining archive rules and delete rules on tables, with conditions to scope which records are affected. Here’s how you can align your requirement with SDM capabilities:

   How SDM Works

Archive Rules: Move records from a source table into an automatically created archive table when they meet a condition (e.g., older than 3 years).

Delete Rules: Permanently remove records when they meet a condition (e.g., older than 7 years).

Conditions: You can filter by fields such as opened_at, created_on, or even by Catalog Item reference (cat_item).

Exclusions: Simply don’t define rules for excluded tables. SDM won’t touch them unless you explicitly configure rules.

   Implementation Steps

Navigate to System Data Management → Archive Rules.

Create a new Archive Rule for the table linked to your Service Catalog Item.

Condition: created_on < (today - 3 years) AND cat_item = <your catalog item sys_id>.

Action: Archive.

Create a Delete Rule.

Condition: created_on < (today - 7 years) AND cat_item = <your catalog item sys_id>.

Action: Delete permanently.

Exclude Tables.

Do not configure rules for lookup/type/choice tables, sys_user, roles/groups, or any sys_ prefixed system tables without out‑of‑box rules.

Maintain a governance list of excluded tables for clarity.

Test in Sub‑Prod.

Run the rules in a lower environment first.

Verify that archive tables contain the expected records.

Confirm deletion only affects the intended records.

 

Refer this video - https://www.youtube.com/watch?v=ZytvntUYrDo


https://www.youtube.com/watch?v=TIkLYGf3XG0