UserRole

Represents a user role in your organization.

Note
This object was called “Role” in previous versions of the API documentation.

Supported Calls

create(), delete(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), update(), upsert()

Special Access Rules

Customer Portal users can't access this object.

Fields

Field Details
CaseAccessForAccountOwner
Type
picklist
Properties
Create, Filter, Group, Nillable, Restricted picklist, Sort, Update
Description
The case access level for the account owner.
ContactAccessForAccountOwner
Type
picklist
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
The contact access level for the account owner.
Note
When DefaultContactAccess is set to Controlled by Parent, you can’t create or update this field.
DeveloperName
Type
string
Properties
Create, Defaulted on create, Filter, Group, Sort, Update
Description
The unique name of the object in the API. This name can contain only underscores and alphanumeric characters, and must be unique in your organization. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. In managed packages, this field prevents naming conflicts on package installations. With this field, a developer can change the object’s name in a managed package and the changes are reflected in a subscriber’s organization. Corresponds to Role Name in the user interface.

This field is available in API version 24.0 and later.

ForecastUserId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
The ID of the forecast manager associated with this role. Label is User ID.
IsPartner
Type
boolean
Properties
Defaulted on create, Filter
Description
Indicates whether the user role is a partner who has access to the partner portal (true) or not (false). This field is not available for release 9.0 and later. Instead, use PortalType with the value Partner.
MayForecastManagerShare
Type
boolean
Properties
Defaulted on create, Filter, Group, Sort
Description
Indicates whether the forecast manager can manually share their own forecast.
Name
Type
string
Properties
Create, Filter, Group, Sort, Update
Description
Required. Name of the role. Corresponds to Label on the user interface.
OpportunityAccessForAccountOwner
Type
picklist
Properties
Create, Filter, Group, Restricted picklist, Sort, Update
Description
Required. The opportunity access level for the account owner. Note that you can’t set a user role with an opportunity access less than that specified in organization-wide defaults.
ParentRoleId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
The ID of the parent role.
PortalRole
Type
picklist
Properties
Filter, Nillable
Description
The portal role: Executive, Manager, User, or PersonAccount.
PortalType
Type
picklist
Properties
Create, Filter, Group, Nillable, Restricted picklist, Sort
Description
This value indicates the type of portal for the role:
  • None: Salesforce application role.
  • CustomerPortal: Customer portal role.
  • Partner: partner portal role. The field IsPartner used in release 8.0 will map to this value.
This field replaces IsPartner beginning with release 9.0.
RollupDescription
Type
string
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
Description of the forecast rollup. Label is Description.

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.

All users have access to invoke 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.
Note
You can’t update any field for a portal role.
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')
© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.