Mass Assign Permission Set License to Users #inSalesforce

Mass Assign Permission Set License to Users


First, know the permission set license id may be like 

Select id, DeveloperName from PermissionSetLicense, get the id returned like 0PL24000000D0K2XXX or developer name returned like CompanyCommunityPsl 

or 

Select id from PermissionSetLicense where MasterLabel = 'Company Community for Force.com'

Id PermissionSetLicense 0PL24000000D0K2XXX


Use query to know who all are not assigned this -  

Select Assignee.Id,Assignee.Name,Assignee.title from PermissionSetLicenseAssign where PermissionSetLicense.DeveloperName <> 'CompanyCommunityPsl' and Assignee.IsActive = true and Assignee.EmployeeNumber <> null 

or 

Select Assignee.Id,Assignee.Name,Assignee.title from PermissionSetLicenseAssign where PermissionSetLicense.MasterLabel <> 'Company Community for Force.com' and Assignee.IsActive = true and Assignee.EmployeeNumber <> null


Mass Update AssigneeId (returned above or to whom the user ids you want to assign), with corresponding PermissionSetLicenseId which is 0PL24000000D0K2XXX. Use data loader or similar tool - Select insert operation and object permissionsetlicenseassign mapped like AssigneeId and PermissionSetLicenseId and done

Comments