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
Andres GuzmanAndres Guzman 

How do I mass unassign a permission set from multiple users?

I need to unassign a permission set to over 140+ users. Is there a way I can do this with workbench or dev console? Thanks!
Andres GuzmanAndres Guzman
Hello Neetu,

Thanks for helping but I already went through those articles and its not what I am looking for. I think the only way to mass unassign a permission set will be with code, unless someone else has another idea.

Thanks!
Alain CabonAlain Cabon
Hello,

PermissionSetAssignment Represents the association between a User and a PermissionSet. This object is available in API version 22.0 and later. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_permissionsetassignment.htm

1) Developer console: query editor or Workbench

select id, AssigneeId,Assignee.Name,PermissionSetId,PermissionSet.Label,PermissionSet.Description  
from PermissionSetAssignment

2) Developer console: Anonymous console or Workbench = Utilities + Apex Execute you can delete records directly like that:

DELETE [select id from PermissionSetAssignment where PermissionSetId = '0PS58000000NQtLGAW' LIMIT 100 ];  

DELETE [select id from PermissionSetAssignment where PermissionSetId = '0PS58000000NQtLGAW'
and AssigneeId in ('005xxxx','005xxxy', ...) ];

AssigneeId = User Ids.

or:

List<PermissionSetAssignment> psa = [select id from PermissionSetAssignment where PermissionSetId = '0PS58000000NQtLGAW' and AssigneeId in ('005xxxx','005xxxy', ...) ];
system.debug('PermissionSetAssignment before: ' + psa.size());
delete psa;

Alain