- 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 11:01 PM
what about state value ? how to find the value of state ?
thank you again

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-17-2021 11:10 PM
There are multiple ways,
1. Filter records in list view to show New records and copy filter query:
Paste the query anywhere and see the state value.
2. Open dictionary of state field and see the state choices.
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-17-2021 11:10 PM
Hi,
you can find the state value by checking the choice list for state field on incident
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-18-2021 09:40 PM
ok thank you heaps , tested in dev...worked...then deployed to production.
thanks heaps for help