+ Start a Discussion
lescclarkcpdlescclarkcpd 

Mass disable customer users

Hi

I have a whole bunch of contacts that have "Customer Portal User" accounts associated with them.  

I want to 'Mass disable' some of these contacts from the customer portal accounts.  You can do this manually on each contact by hitting 'manage external users' and then 'disable customer user' but want to see if I can create a trigger to do this en mass, any ideas as to the method to do this, can't sem to find reference to this anywhere

thanks
les
Vinita_SFDCVinita_SFDC
Hello,

You can execute following code for disabling portal users in mass:

list<user> lst = new list<user>();

for(user u :[SELECT id, name , IsPortalEnabled FROM User where isportalenabled = true]){
   u.isactive = false;
   lst.add(u);
}
Update lst;

You can execute this code in anonymous apex script in the developer console or in Force.com Ide
lescclarkcpdlescclarkcpd
hi, thanks but ....

this sets the user account to inactive, it doesn't 'disable customer user'

the contact and the user are still linked, it's this link that I want to delete

thanks
Julia StewartJulia Stewart
Hi lescclarkcpd, did you ever figure this out?