how to delete multiple closed state records in incident table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 01:18 AM
how can i delete all closed state records in incident table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 01:20 AM
Hi DEV,
There are multiple ways you can delete the records.
1. Background or Fix Script
2. List Layout
3. Form Layout'
Please reason out why you want to delete, and take one of above option
Thank you
Prasad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 01:50 AM
Hi Dev,
I would not suggest to delete closed incident, we do have an active field which states if the incident is active or inactive.
Below is the fix script you can use.
var gr = new GlideRecord('incident');
gr.addEncodedQuery('state=7');
gr.query();
gs.info("***INFO: Deleting these many records: " + gr.getRowCount());
gr.deleteMultiple();
Regards,
Deepankar Mathur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 02:57 AM
Hello,
If you are having access as Admin you can select those records by filtering the closed Incidents.
And once you go below: You will be having an option DELETE the selected records.
2. You could also write Background or Fix Script to delete.
click on 'helpful' - If my ans if helpful for you.
Regards,
Praveen