how to delete multiple closed state records in incident table

DEV19
Kilo Explorer

how can i delete all closed state records in incident table

3 REPLIES 3

Prasad Pagar
Mega Sage

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

dmathur09
Kilo Sage
Kilo Sage

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

Praveen Tripath
Giga Expert

Hello, 

If you are having access as Admin you can select those records by filtering the closed Incidents.

find_real_file.png

And once you go below: You will be having an option DELETE the selected records. 

find_real_file.png

 

2. You could also write Background or Fix Script to delete.

 

click on 'helpful' - If my ans if helpful for you. 

Regards,

Praveen