
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
05-12-2025 11:02 AM - edited 05-16-2025 09:31 AM
Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
Hi there,
With the Tokyo release ServiceNow introduced "Data Management Delete Jobs", a way to safely and efficiently perform bulk deletion of records without the need for scripting. Amongst others, also an option to schedule the jobs is included. Though how to schedule it and how does the scheduling work behind the scenes? Wondering how to schedule it since for some it seemed to work, for others not... several YouTube videos also mention the option to schedule the jobs, though none of them actually show it!
Note: You might think don't we already have no-code options to perform bulk deletions, like Table Cleaners? No! Table Cleaners are NOT intended to perform one-off bulk deletions or to perform an initial bulk deletion.
Data Management
With the Quebec release, ServiceNow introduced "System Data Management". One of the options, a way to safely and efficiently perform bulk updates of records (Update Jobs [sys_dm_update]) without the need for scripting.
Delete Jobs
With the Tokyo release, ServiceNow expanded System Data Management with "Delete Jobs" [sys_dm_delete], similar to Update Jobs, a way to safely and efficiently perform bulk updates of records without the need for scripting.
Schedule: Run at
Both Update Jobs and Delete Jobs contain an option to schedule the execution using the "Run at" field. Or, that's what the documentation mentions. Just applying the Run at field when creating the record should do the trick. Also several YouTube videos do mention this, though none of them actually show it. Trying to schedule a Delete Job myself initially I couldn't get this going, created a Support Case that took more than 1.5 week, asked on Community and SNDevs Slack, all no luck. The records just would not trigger on the entered Run at time.
Save versus Update
My expectation was that for example a Schedule [sys_trigger] should be created that should trigger the Delete Job at the Run at time. Searching for sys_trigger records, sysauto_script records, etcetera there was nothing to find. Using Code Search with SNUtils and input "dm_" several artifacts were found. Going through them one by one, the "Update" UI Action looked interesting.
This UI Action does include UI Page "dm_schedule_deletion", which includes Script Include "DMTSchedulerUtils". The Script Include unfortunately protected, though the description and code of the previous two records all give away that this is what we are after. In short, when using the Save UI Action nothing will happen, there are no business rules or whatever that would schedule the Deleted Job to execute on its given Run at date/time. The Update UI Action does trigger creating a Schedule [sys_trigger]. Any existing Schedule records are deleted by Business Rule "Delete Scheduled Job if it Exists".
Schedule
Here is an example of when a Delete Job is scheduled and how the Schedule [sys_trigger] and especially the Script field look like.
The script performed by the Schedule [sys_trigger]:
var gr = new GlideRecord('sys_dm_delete');
gr.addQuery('sys_id', 'c0e39884c3cd2a1022b612f1b40131d8');
gr.query();
if (gr.next()) {
var dmAPI = new SNC.DataManagementAPI();
dmAPI.executeDelete(gr);
}
---
That's it. Hope you like it. If any questions or remarks, let me know!
C |
If this content helped you, I would appreciate it if you hit bookmark or mark it as helpful.
Interested in more Articles, Blogs, Videos, Podcasts, Share projects I shared/participated in? |
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
- 1,626 Views