PermissionSetAssignment
Represents a user’s assignment to a permission set or permission set group.
Introduced in API version 22.0.
create(), delete(), describeSObjects(), query(), retrieve(), update()
-
As of Summer ’20 and later, only users who have one of these permissions can access this object:
- View Setup and Configuration
- Assign Permission Sets
- Manage User
-
Type: reference
-
Properties: Create, Filter, Group, Sort
-
Description:
The ID of the user that is assigned the permission set indicated in
PermissionSetIdor the permission set group indicated inPermissionSetGroupId.This is a relationship field.
-
Relationship name: Assignee
-
Relationship type: relationship
-
Refers to: User
- Type: datetime
- Properties: Create, Filter, Nillable, Sort, Update
- Introduced: API version 52.0
- Description: The date that the assignment of the permission set or permission set group expires for the specified user.
- Type: boolean
- Properties: Defaulted on create, Filter, Group, Sort
- Introduced: API version 52.0
- Description: Indicates whether the assignment is active (
true) or not (false). Defaults tofalse. - Default value: false
- Type: boolean
- Properties: Defaulted on create, Filter, Group, Sort, Update
- Introduced: API version 57.0
- Description: Indicates whether the assignment was revoked (
true) or not (false). Defaults tofalse. This field is available only if user access policies are enabled. - Default value: false
-
Type: reference
-
Properties: Filter, Group, Nillable, Sort
-
Introduced: API version 57.0
-
Description:
The ID of the user access change record related to this permission set or permission set group assignment. This field is available only if user access policies are enabled.
This field is a relationship field.
-
Relationship name: LastCreatedByChange
-
Relationship type: relationship
-
Refers to: UserAccessChange
-
Type: reference
-
Properties: Filter, Group, Nillable, Sort
-
Introduced: API version 57.0
-
Description:
The ID of the user access change record related to this permission set or permission set group assignment being revoked. This field is available only if user access policies are enabled.
This field is a relationship field.
-
Relationship name: LastDeletedByChange
-
Relationship type: relationship
-
Refers to: UserAccessChange
-
Type: reference
-
Properties: Create, Filter, Group, Nillable, Sort
-
Introduced: API version 41.0
-
Description:
The ID of the permission set group assigned to the user specified in
AssigneeId.This is a relationship field.
-
Relationship name: PermissionSetGroup
-
Relationship type: relationship
-
Refers to: PermissionSetGroup
-
Type: reference
-
Properties: Create, Filter, Group, Nillable, Sort
-
Description:
The ID of the permission set assigned to the user specified in
AssigneeId.This is a relationship field.
-
Relationship name: PermissionSet
-
Relationship type: relationship
-
Refers to: PermissionSet
-
Finding Permission Set Assignments: Use the PermissionSetAssignment object to query permission set assignments to find out which permission sets are assigned to which users. Because each user can be assigned to many permission sets and each permission set can be assigned to many users, each PermissionSetAssignment ID represents the association of a single user and single permission set.
For example, to search for all permission sets assigned to a particular user:
To search for all users assigned to a particular permission set:
You can also create a new permission set assignment, or use delete to remove a permission set that’s assigned to a user. To update an assignment, delete an existing assignment and insert a new one.
-
User Licenses: When assigning a permission set, if the PermissionSet has a
UserLicenseId, itsUserLicenseIdand the ProfileUserLicenseIdmust match. To determine a user’s license assignment, query the user’s profile and then query the profile’s license.For example, to find a user’s profile ID:
To find a permission set’s
UserLicenseId:If the IDs match, the assignment succeeds.
To find all the permission sets with no license that are assigned to any user:
-
Revoked Assignments from User Access Policies: After you revoke a permission set or permission set group assignment via a user access policy, the
IsRevokedfield is updated totrue. The PermissionSetAssignment record isn’t deleted. If the permission set or permission set group is assigned to the user again, theIsRevokedfield is then updated tofalse.To find permission set or permission set group assignments that were revoked: