Print this page

How to remove Permission Set Assignments using the API

Knowledge Article Number 000097208
Description If a permission set is assigned to a user and one of the permissions causes issues (like a system administrator profile), one way to remove the permission set is via the API (data loader or workbench)
Resolution A user would have to have permissions to assign Permission Sets and remember their password. For example, let's say a system administrator assigned themselves the API Only permission in a Permission Set. The next time they tried to login to their org via the UI, they would find themselves unable to successfully login. 

Using an API enabled product, like Dataloader or workbench (public accessible workbench is located here - https://workbench.developerforce.com/login.php), query the PermissionSetAssignment object. Identify the ID of the record matching the User and Permission Set that is affecting the access.

Steps to export PermissionSetAssignment with Data Loader

1. Log into the Data Loader

2. Click Export

3. Click "Show all Salesforce objects"

4. Choose PermissionSetAssignment

5. Next

6 .Select all the fields

7. Finish

With this file, you can identify the permission set assignment that you want to delete. After identifying it, copy the "Id" column into a new .csv file and save it.

Steps to delete the PermissionSetAssignment

1. Log into the Data Loader

2. Click Delete

3. Click "Show all Salesforce objects"

4. Choose PermissionSetAssignment

5. Select the file that contains the PermissionSetAssignment Id.

6. Map the PermissionSetAssignment Id with the Id on your file.

7. Finish.

Workbench

1. In Workbench, the process a little easier.

2. Identify the PermissionSetAssignment ID that is affecting the user

3. Mouse over the ID and a window will appear giving the option to delete

4. Click on the delete link and a confirmation page  will appear. Once the record is deleted, the Permission Set should no longer be assigned to the user. 

Based on this solution, you can also mass add permission set via Dataloader

1. Select “Insert” from the DataLoader menu .
2. Select "PermissionSetAssignment" from the ObjectType menu
3. Select the “From File” radio button and choose your CSV-formatted spreadsheet.
4. Click “Next”
5. Map the columns from your spreadsheet as appropriate.
6. Map User ID with Assignee Id and permission Set Id with PermissionSet Id
7. Click “Confirm Insert"




promote demote