- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-17-2021 07:22 PM
Hi I am new to service now and trying to bulk delete unwanted incidents from incident table based on short description value "AP disconnected" and state of incident is "New"
Instead of selecting and deleting each incident, how can I achieve this in one hit. If a script required to do this , can some help please.????
and what kind of script should i be using.???? and how to run it ? please bear with me I inherited this service now environment recently and I am new to this.
thank you folks
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-17-2021 09:06 PM
Hi,
You can use background script or Fix Script to run server side scripts on demand.
1. Create a Fix script record and write below script:
And run the script to delete incidents.
I would suggest to use setLimit and delete 100/1000 incidents at a time.
deleteIncidents();
function deleteIncidents() {
var incGr = new GlideRecord('incident');
incGr.addQuery('short_description','AP disconnected'); //
incGr.addQuery('state',1); // state is New (check state value in your instance and replace)
incGr.setLimit('100');
incGr.setWorkflow(false);
incGr.deleteMultiple();
}
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-17-2021 09:06 PM
Hi,
You can use background script or Fix Script to run server side scripts on demand.
1. Create a Fix script record and write below script:
And run the script to delete incidents.
I would suggest to use setLimit and delete 100/1000 incidents at a time.
deleteIncidents();
function deleteIncidents() {
var incGr = new GlideRecord('incident');
incGr.addQuery('short_description','AP disconnected'); //
incGr.addQuery('state',1); // state is New (check state value in your instance and replace)
incGr.setLimit('100');
incGr.setWorkflow(false);
incGr.deleteMultiple();
}
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-17-2021 09:47 PM
Thank you very much Anil for your swift response. You are a legend I appreciate it. you saved heaps of time.
Just a question, is the state value translated to a number ? for example
new = 1,
in progress = 2,
on hold = 3 ? and so on ? and if so how would i find these numbers for each state value?
Regards
Elias
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-17-2021 09:50 PM
my other question is, using fix script can you run it on demand or it runs always?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-17-2021 09:55 PM
It is on Demand script, you have to run it manually.
We prefer Fix script because you can capture it in Update set and move to next instance after testing it on non-prod instances.
Thanks,
Anil Lande
Thanks
Anil Lande