Need a schedule job to retire the record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 11:10 PM
HI Community,
I have a requirement, the software instances (cmdb_software_instance) table will be updating on the daily basics in our system. Now I need to write a schedule job to retire the software data/records which are not updated for the last 7 days.
How can we achieve this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 05:12 AM
HI @Ankur Bawiskar ,
I need to ran a schedule job to remove the install on from the software instances.
This software instances table is getting updated on daily basics if the records are not updated for last 7 days then i need to remove the install on from those records.
for example i have filtered out the install on by X and all the records are upadted more then 7 days so now i need to remove the install on from name (each of the record)
can you help me with that how can i achieve this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 05:20 AM
so what script did you start with?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 05:24 AM
HI @Ankur Bawiskar ,
I have not started yet as the requirement got changed need to remove those and not to retire it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 05:29 AM
check below script.
I believe I have answered your question and you can take it further from here.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2025 05:23 AM
something like this should help, please enhance
(function() {
var gr = new GlideRecord('cmdb_software_instance');
var sevenDaysAgo = gs.daysAgoStart(7);
gr.addQuery('sys_updated_on', '<', sevenDaysAgo);
gr.query();
while (gr.next()) {
gr.setValue('software', ''); // clear the softward field
gr.update();
}
})();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader