UserRole
Supported Calls
create(), delete(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), update(), upsert()
Special Access Rules
As of Summer ’20 and later, only users with the View Roles and Role Hierarchy permission can access this object, and only users with the Manage Roles permission can edit this object.
Fields
| Field | Details |
|---|---|
| CaseAccessForAccountOwner |
|
| ContactAccessForAccountOwner |
|
| DeveloperName |
|
| ForecastUserId |
|
| IsPartner |
|
| MayForecastManagerShare |
|
| Name |
|
| OpportunityAccessForAccountOwner |
|
| ParentRoleId |
|
| PortalAccountId |
|
| PortalAccountOwnerId |
|
| PortalRole |
|
| PortalType |
|
| RollupDescription |
|
Usage
Use this object to query the set of currently configured user roles in your organization. Use it in your client application to obtain valid UserRole IDs to use when querying or modifying a User record.
Users with the View Roles and Role Hierarchy permission can query or describe this
object. If your client application logs in with the “Manage Users”
permission, it can query, create, update, or delete UserRole records.
For example, the following code finds all roles that are not assigned to any
users.
SELECT Id, Name, DeveloperName
FROM UserRole
WHERE Id NOT IN (SELECT UserRoleId
FROM User
WHERE UserRoleId !='000000000000000')