{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":38705,"path":"platform-administration/dmc-create-onetime-delete-rule.md","title":"Create a one-time delete rule","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a one-time delete rule\n\nDefine a rule for deleting records now or at a later date.\n\n## Before you begin\n\nRole required: admin\n\n## About this task\n\nCreate a one-time delete rule to delete records once. To delete records on a recurring basis, see [Create a cleanup rule](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/dmc-create-cleanup-rule.md).\n\n## Procedure\n\n1.  Access the create rule wizard in the Data Management Console in one of the following ways.\n\n<table id=\"choicetable_snz_r2m_13c\"><thead><tr><th align=\"left\" id=\"d134856e72\">\n\nOption\n\n</th><th align=\"left\" id=\"d134856e75\">\n\nSteps\n\n</th></tr></thead><tbody><tr><td id=\"d134856e81\">\n\n**Overview tab**\n\n</td><td>\n\n1.  Navigate to **All** &gt; **System Data Management** &gt; **Data Management Console** &gt; ****.\n2.  On the Overview tab, select the table with records that you want to delete.\n3.  Select **Create rule**.\n\n\n</td></tr><tr><td id=\"d134856e119\">\n\n**Rules tab**\n\n</td><td>\n\n1.  Navigate to **All** &gt; **System Data Management** &gt; **Data Management Console** &gt; ****.\n2.  On the Tables tab, select the table with records that you want to delete.\n3.  On the table details page, select the Rules tab.\n4.  Select **Create rule**.\n\n\n</td></tr></tbody>\n</table>2.  Define the one-time delete rule.\n\n    1.  On the Define your rule page, select **One-time delete** as the rule type.\n\n    2.  Enter a name and description for the rule.\n\n        The name is used as the [display value](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/c_DisplayValues.md) for references to this rule.\n\n    3.  Select **Save and continue**.\n\n\n## Define one-time delete rule conditions\n\nDefine one or more conditions that identify the records to be deleted.\n\n### Before you begin\n\nRole required: admin\n\n### About this task\n\nUse the condition builder to specify filter conditions that define the records to be deleted.\n\n**Important:** Deleting records can cause unexpected cascade deletion. Preview the number of records that will be affected before activating the rule and change the conditions as needed.\n\n### Procedure\n\n1.  On the Define conditions page, limit the number of records by adding one or more conditions that records must meet.\n\n    1.  Select a field, operator, and field value.\n\n        For example, **\\[Category\\] \\[is\\] \\[Software\\]**.\n\n    2.  Use the OR and AND operators to add conditions.\n\n    3.  Select **Add condition set Criteria** to add another set of conditions.\n\n    **Note:** Limiting the number of records that are added to the one-time delete job can help prevent the table from being locked when the job is executed.\n\n2.  View the records that match the conditions by selecting **Preview affected records**.\n\n    The list of records appears in a new browser tab.\n\n3.  On the Define conditions page, select **Save and continue**.\n\n\n## Select associated records to delete\n\nSpecify which associated records to delete when the one-time delete rule runs.\n\n### Before you begin\n\nRole required: admin\n\n### About this task\n\nDeleting records in a table also deletes records from tables that extend or reference the source table. Preview the affected records before you execute a delete job and learn about other tables that are impacted.\n\nUp to three levels of cascaded records are deleted when the job is executed. For example, if the preview identifies incidents that match the conditions, it will also delete any problems that reference those incidents, defects that reference those problems, and test records that reference the defects. If sys\\_attachment and sys\\_attachment\\_docs table records are associated with the incidents, those records might not appear in the preview but they are deleted as well.\n\n### Procedure\n\n1.  On the Delete associated records page, view the count of records from the source table that match the conditions in the one-time delete rule by selecting **Preview cascade**.\n\n    The **Preview cascade delete records** dialog displays the estimate. Counts for records in other tables that reference those source records are listed as well, although those counts are only close estimates.\n\n2.  Review the count of affected records by table to ensure that the records are safe to delete.\n\n3.  Note that a rollback context is created by default.\n\n    **Important:** If you need to restore records deleted by accident, you have up to fourteen days to execute the rollback job.\n\n4.  Run predefined business rules after records are deleted by selecting **Run business rules and engines**.\n\n5.  Select **Save and continue**.\n\n\n## Schedule or execute a one-time delete rule\n\nSchedule a date and time to execute a one-time delete rule or execute it after you finish creating it.\n\n### Before you begin\n\nRole required: admin\n\n### About this task\n\nConsider scheduling the one-time delete rule to run during non-business hours to minimize the potential performance impact on your users. Deleting all records in a table temporarily locks the table, which prevents inserts and updates. If you want to delete all records from a table, use a cleanup rule instead. For more information, see [Deleting older or unwanted records in Data Management Console](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/deleting-records.md).\n\n### Procedure\n\n1.  On the Set up schedule page, schedule the one-time delete rule to run now or at a later date.\n\n<table id=\"choicetable_orr_f3t_13c\"><thead><tr><th align=\"left\" id=\"d134856e499\">\n\nOption\n\n</th><th align=\"left\" id=\"d134856e502\">\n\nDescription\n\n</th></tr></thead><tbody><tr><td id=\"d134856e508\">\n\n**Schedule later**\n\n</td><td>\n\nSet up a schedule at a later time.\n\n</td></tr><tr><td id=\"d134856e517\">\n\n**Execute upon creation**\n\n</td><td>\n\nRun the one-time delete rule immediately after you finish creating it.\n\n</td></tr><tr><td id=\"d134856e526\">\n\n**Run at**\n\n</td><td>\n\nSelect a date and time to run the one-time delete rule.**Note:** Scheduling at a later date and time might affect a different number of records.\n\n</td></tr></tbody>\n</table>2.  Select **Save and continue**.\n\n\n## View a summary of your one-time delete rule\n\nView a summary of your one-time delete rule and acknowledge the deletion.\n\n### Before you begin\n\nYou must activate the one-time delete rule and its corresponding data management policy for it to run.\n\nRole required: admin\n\n### Procedure\n\n1.  On the Rule summary page, review the one-time delete rule conditions and settings.\n\n2.  Read and verify the deletion by selecting the acknowledgment statement.\n\n\n### Result\n\nThe one-time delete rule runs based on the chosen schedule and deletes records when they meet the conditions that you set for them.\n\n"}}