+ Start a Discussion

How to disable portal users in bulk or through api?

Is there any easy way to disable portal users through any api calls ? I am trying to delete contact in bulk, but they are all portal contacts. I am unable to delete them unless I manually disable the portal users associated with these contacts . 


I wonder if there is any other easy way to do it?



If you have developer knowledge you can also use an anonymous apex script in the developer console / force ide or workbench. An example: 


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

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

 This will put ALL your portal users to inactive. I expect you would want to select certain subsets of users.