- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2019 06:54 AM
Hi All,
Long time reader, first time poster.
Due to legal requirements, one of our clients has requested that 5,000+ incident records are deleted. We have been provided with a .csv file that contains all of these incident numbers.
We need to create a background script that will delete these records, or failing that, update the resolution notes (or anywhere, really) with something unique so that we can report against this "something unique" and cmd-click through all of them and delete them that way.
Truth be told, I'm agnostic as to how we get this done short of deleting them one by one by one by one.
Any help would be appreciated.
Thanks,
Scott
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 07:13 AM
You don't have to add incident numbers in the script, You just need to include those in the Value field of your System property. In the image it was shown in Choices field which is Incorrect and you can clear them off. And then add its name in the script.
var incs = gs.getProperty('inc.numbers'); //Your property name here
var gr = new GlideRecord('incident');
gr.addEncodedQuery('numberIN'+incs);
gr.deleteMultiple();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 07:09 AM
I don't think I'm asking the question clearly enough. After creating the new system property (as shown in Alikutty's VERY helpful screenshot), where would i plug those numbers into the script?
Like this?
var incs = gs.getProperty('INCXXX,INC123,INC577,etc'); //Your property name here
var gr = new GlideRecord('incident');
gr.addEncodedQuery('numberIN'+incs);
gr.deleteMultiple();
Hopefully my question makes more sense now.
Also, thanks everyone for being so gracious with my ignorance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 07:13 AM
You don't have to add incident numbers in the script, You just need to include those in the Value field of your System property. In the image it was shown in Choices field which is Incorrect and you can clear them off. And then add its name in the script.
var incs = gs.getProperty('inc.numbers'); //Your property name here
var gr = new GlideRecord('incident');
gr.addEncodedQuery('numberIN'+incs);
gr.deleteMultiple();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 08:06 AM
Alikutty, you beautiful genius! This did the trick!
THANK YOU!