The Salesforce sObject API is an important part of permission sets, allowing you to perform tasks that you cannot perform through the permission set UIs. Some administrators may already be comfortable with the salesforce.com sObject API, but for those who are not, it is possible to use the API without writing a bunch of source code by using the Workbench tool at http://workbench.developerforce.com/. While Workbench has a great query builder interface, below are some example queries.
Users with a Permission like Modify All Data
SELECT AssigneeId, Assignee.Name, PermissionSet.Label, PermissionSet.isOwnedByProfile
FROM PermissionSetAssignment
WHERE PermissionSet.PermissionsModifyAllData = true
Permission Sets Assigned to a User
FROM PermissionSetAssignment
WHERE Assignee.Username = 'admin@my.org' AND
PermissionSet.isOwnedByProfile = false
Permission Sets with a Particular Token
SELECT Id, Name, Description
FROM PermissionSet
WHERE Description Like '%#salesrep#%'
Mass Assign Permission Sets to Users
Mass Assign Permission Sets to Users
It is possible to perform mass assignment of permission sets via the sObject API. This is performed by inserting PermissionSetAssignment records (unassigning is nothing more than deleting the PermissionSetAssignment records). To perform this operation with a spreadsheet and the Workbench, follow these instructions:
- Select “Insert” from the “Data” menu at the top of your browser window.
- Select PermissionSetAssignment from the ObjectType menu
- Select the “From File” radio button and choose your CSV-formatted spreadsheet.
- Click “Next”
- Map the columns from your spreadsheet as appropriate.
- Click “Map Fields”
- Choose whether you wish to process the request asynchronously
- Click “Confirm Insert”
This is so useful! Is there a resource that lists the different permission names that can be queried this way?
ReplyDeleteHi Rhonda,
DeleteI'm working on a post to help with this. The single best method I know is to use the describeSObject() method which you can use with the workbench tool by going to Info > Standard & Custom Objects and selecting either permission set or profile from the picklist. The reason why you have to do this is that on an org-by-org basis, permission values will change based on what was purchased, enabled, etc… Hope this helps!