Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 10:52 PM
hi
I want to delete empty records from user table. How to achieve this by using script?
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 11:06 PM
Hi @SK36 ,
I'm considering here username as empty. You may have different field. apply query according to that.
var gr = new GlideRecord('sys_user');
gr.addEncodedQuery('user_nameISEMPTY'); // user_nameISEMPTY if user id field is empty and people id filed is empty
gr.query();
while (gr.next()) {
gr.deleteMultiple();
}
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 11:13 PM
You can use both the ways.
Either in fix script or in background script. But if more records e.g. more that 500+ then go with fix script.