Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

I would like delete the multiple users in the user table ,By the background script

Hari Babu
Mega Expert

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

1 ACCEPTED SOLUTION

Hari Babu
Mega Expert

Tq Guys , for your support,

 

 

 

Regards,

Jagadeesh

View solution in original post

7 REPLIES 7

VigneshMC
Mega Sage

Try 

var user = new GlideRecord('sys_user');
user.addEncodedQuery('');//add your query;
user.query();
while(user.next()){
	user.deleteRecord();
}

Raju Koyagura
Tera Guru

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();

RajP79032538207
Mega Guru

var gr = new GlideRecord('sys_user');

 

 

gr.query();

 

while (gr.next()) {

 

  gr.deleteMultiple(); 

}

RajP79032538207
Mega Guru

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