logo

NJP

Delete Jobs and Update Jobs in Tokyo - deleting data is now safe and easy

Import · Sep 21, 2022 · article

The problem

How many times you've been tasked to delete or update big amout of data in ServiceNow?

Deleting/updating a big amount of data is oftenly achieved via scripting - either background scripts or fix scripts are used.

This is always leading to some uncertainty related to what exactly is going to be deleted/updated, as well as the cascading deletion/update that is triggered as a consquence.

Of course, one can (actually must) use log messages to verify the data before the delete/update statements execution. But still, this is inconvinient and might lead to data loss if not done right.

System Data Management in Tokyo

Since Tokyo, ServiceNow is introducing new application menu - System Data Management.

It consists of two modules:

image

Since these are more or less similar, apart from the operation that they do, I will give some examples with the delete jobs, but these are also applicable to the Update jobs as well.

image

To create a new job, one first must select a table and the apply some filtering if needed. There is also a checkbox Run business rules and engines (gr.setWorkflow (false), right...)

There is also a Preview button, to show us the total count to the records that fulfil the condition, as well as a link to these.

image

Clicking Continue will give tou possibility to select a time to run the deletion (Run at), as well as two related links - to preview the Cascade and one to Execute the job immediately.

Clicking Preview cascade will populate the related lists with all cascading records that will be also deleted, along with their count (and the actual deleted records count, once the job is executed):

image

Clicking Execute now will prompt us to Proceed or Cancel (along with the warning message). If we proceed we will see a screen, similar to the Data import, with information about the execution:

image

If we go to Check execution results, we will be presented with information about the deleted records (both direct and cascaded).

image

But what is more important - We are presented with a related link to Rollback the transaction if needed.

image

Conclusion

In my opinion, this functionality was much needed since ages, as the only way to manage big amount of data was scripting. I am really happy that we have it now in Tokyo and I want to share it with as many people as I can.

Please mark Helpful, Bookmark and feel free to share with your network. Thanks in advance!

Martin Ivanov
Community Rising Star 2022

View original source

https://www.servicenow.com/community/developer-articles/delete-jobs-and-update-jobs-in-tokyo-deleting-data-is-now-safe/ta-p/2317438