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
saharisahari 

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?

 

SamuelDeRyckeSamuelDeRycke

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;
   lst.add(u);
}
update lst;

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