- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2018 01:28 PM
Hi All,
Need help to delete the records from custom(delete_Records) table and move those deleted record to another custom table (deleted_records) via scheduled job or (any other efficient way)
I tried below query which is working as expected where records are deleted Only when end date(field) is today(or end date reaches current date)
var gr = new GlideRecord('delete_Records');
gr.addQuery('end_dateONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
gr.query();
gr.next();
gr.deleteRecord();
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2018 01:43 PM
try
var gr = new GlideRecord('incident')
gr.addEncodedQuery('end_dateONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()'); //to delete all inactive incidents
gr.deleteMultiple();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2018 01:43 PM
try
var gr = new GlideRecord('incident')
gr.addEncodedQuery('end_dateONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()'); //to delete all inactive incidents
gr.deleteMultiple();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2018 01:50 PM
I am looking forward to store the deleted records in new custom table
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2018 01:56 PM
There is an audit table which holds the deleted records. The module is under System Definition > Deleted Records. I guess you could just have the custom table have a reference field for the record on the deleted records table, but that's redundant.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2018 03:10 PM
Hi,
What would be the alternative option to store the deleted records so that when it refer to old incidents, it shouldn't be orphan
Suppose the records got deleted and being referred to closed incident So how can you refer that closed incident to deleted record
Is there any way ?
Thanks