- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 05:48 AM
Hi Friends,
I would like delete the multiple users in the user table ,By the background script
Can you please share me the script .
Regards,
Jagadeesh
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 06:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 05:53 AM
Try
var user = new GlideRecord('sys_user');
user.addEncodedQuery('');//add your query;
user.query();
while(user.next()){
user.deleteRecord();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 05:53 AM
Use below script and change the query as you need...
var gr = new GlideRecord('sys_user')
//gr.addEncodedQuery('active=false');
gr.addQuery('active','false'); //to delete all inactive users
gr.deleteMultiple();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 06:19 AM
var gr = new GlideRecord('sys_user');
gr.query();
while (gr.next()) {
gr.deleteMultiple();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 06:22 AM
Hi Jagadeesh,
Please go through below code may be it will help you:
var gr = new GlideRecord('sys_user');
gr.query();
while (gr.next()) {
gr.deleteMultiple();
}
NOTE: Mark correct or helpful if it helps you.
Warm Regards,
Raj patel

