function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pallavi reddypallavi reddy 

how to deactivate multiple users at a time

Best Answer chosen by pallavi reddy
Himanshu ParasharHimanshu Parashar
Hi Pallavi,

Following code should work. you can add filter criteria in SOQL with your choice.
 
//Get user
List<User> userlist =  [select id from user limit 5];
for(User u : userlist)
{
   u.isactive=false;
}

//update user list
if(userlist.size()>0)
    update userlist;

Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

All Answers

Himanshu ParasharHimanshu Parashar
Hi Pallavi,

Following code should work. you can add filter criteria in SOQL with your choice.
 
//Get user
List<User> userlist =  [select id from user limit 5];
for(User u : userlist)
{
   u.isactive=false;
}

//update user list
if(userlist.size()>0)
    update userlist;

Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
This was selected as the best answer
Kris KargonKris Kargon
Most of the students struggling to do their dissertation by own. That is the reason they approaching the writing services to buy dissertation online (https://uk.answers.yahoo.com/question/index?qid=20110415075430AAOeiDl). The best dissertation writing service offers the best dissertation for the students. Each dissertation is written by professional writers. They are well qualified and have years of experience in this field. 
SIVASASNKARSIVASASNKAR
Hi All,

I've query here, if the org has the sharing rules and Deactive users have owned records then how can we transfer the records anothoer user automatically without manual process(Mass transfer) a. Is there any tool that will help to transfer automatically and the records will share automatically without any effect.

Thanks,
Sivasankar K.
Vishal AswalVishal Aswal
Nice Collection Bro.. Best on the internet..i have also written some on diwali please check it out...
Happy Diwali Status Quotes for Gf (https://happydiwalistatusmsg.blogspot.com/p/blog-page.html" target="_blank)
Funny Happy Diwali Status Quotes in Hindi (https://happydiwalistatusmsg.blogspot.com/p/funny-for-whatsapp-and-facebook-happy.html)
Diwali Status Quotes in Hindi Font (https://happydiwalistatusmsg.blogspot.com/p/2018-happy-diwali-imageshappy.html" target="_blank)
Funny Happy Diwali Status (https://happydiwalistatusmsg.blogspot.com/p/funny-happy-diwali-status-message.html" target="_blank)
 
sumanta murmusumanta murmu
i want learn html. to make a blog in blogger... Bangla Shayari (https://www.lovesmsbangla.xyz/2020/11/bengali-shayari-image-free-download.html)