How to Delete Incident Records in ServiceNow Using Delete Jobs ?

ServiceNow’s Delete Jobs feature within the System Data Management module allows administrators to perform bulk deletions of records based on specific conditions. This feature helps maintain the cleanliness of your data by removing unnecessary or outdated records. In this article, we will walk through the process of creating a Delete Job to delete incident records where the Short Description contains the word “test.”

Use Case: Deleting Test Incident Records

Problem:

You have a collection of incident records that were created as part of testing or troubleshooting and still exist in the system. These records contain the word “test” in the Short Description, and they are no longer needed in the system. Keeping these test records can clutter your database and impact reporting, performance, and overall data integrity.

Goal:

To delete all incident records where the Short Description contains the word “test.”


Step-by-Step Guide

1. Navigate to Delete Jobs

  • In the ServiceNow application navigator, search for System Data Management > Delete Jobs.
  • This will take you to the list of existing delete jobs and allow you to create a new one.

2. Create a New Delete Job

  • Click New to create a new delete job.
  • Fill out the form with the following details:
  • Description: Enter a description like “Delete Incident Records with ‘Test’ in Short Description.”
  • Table: Select Incident from the dropdown list.
  • Run business rules and engines: Set this to True if you want business rules to be triggered during the deletion. This ensures that any automated processes associated with incident records (like notifications or workflows) are respected. If you don’t need these processes to run, set it to False.

3. Define the Conditions

To select the specific records that need to be deleted, define the following condition:

  • Short Description contains “test.”

This ensures that only incident records with the word “test” in the Short Description will be targeted for deletion.

  • You can also use AND or OR operators to add additional conditions if necessary. For example, if you only want to delete records that are in a particular state (like “New” or “In Progress”), you can add that condition as well.
  • Example:
    • State [is] [New] (optional additional condition).

4. Preview the Delete Job

  • Before actually deleting the records, it’s a good idea to Preview the job. This will show you the number of records that match the conditions you’ve set.
  • Clicking on the number of matching records will allow you to view all the records that will be deleted by the job.

5. Schedule or Execute the Delete Job

Once you’ve reviewed the conditions and previewed the affected records, click Continue to save the delete job.

  • Run at: You can schedule the job to run at a later time. This is helpful if you want to delete records during off-hours to minimize the impact on system performance.
  • Execute Now: To delete the records immediately, click Execute Now.

6. Monitor the Delete Job Execution

  • After executing the job, monitor the deletion progress. You can use the Check execution results option to verify the status of the delete job and identify any issues that occurred during the process.
  • If you want to view the executed delete job, go to System Data Management > Delete Jobs, open the job record, and check the results under the Related Links section.

7. Rollback the Delete Job (If Needed)

  • If you realize that you have deleted the wrong records or made an unintended deletion, you can Rollback the delete job to restore the records.
  • To do this, navigate to the completed job, and under Related Links, click on Rollback. This will undo the deletions and restore the deleted records.

Best Practices for Using Delete Jobs

  • Test in a Sub-Production Environment: Always test the delete job in a sub-production instance to ensure it works as expected before applying it to production data.
  • Backup Data: Consider backing up the data before running any delete jobs, especially if you’re deleting critical records.
  • Review Logs: After executing the job, review the logs for any errors or skipped records to ensure that the deletion was successful.

Conclusion

Using Delete Jobs in ServiceNow is an effective way to clean up unnecessary or outdated records. In this use case, deleting incident records where the Short Description contains “test” ensures that your system remains free from clutter caused by test records. With the ability to preview the records, schedule the deletion, and roll back changes if necessary, Delete Jobs provide administrators with a powerful and flexible tool for maintaining data integrity. By following the steps outlined in this guide, you can safely delete test incident records and improve your ServiceNow environment’s overall data quality.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *