UserRecordAccess

Represents a user’s access to a set of records. This object is read-only and is available in API version 24.0 and later.

Supported Calls

describeSObjects(), query()

Fields

Field Details
HasAllAccess
Type
boolean
Properties
Defaulted on create, Filter, Nillable, Sort
Description
Indicates whether a user has all access–read, edit, delete, and transfer—to the record (true) or not (false).
HasDeleteAccess
Type
boolean
Properties
Defaulted on create, Filter, Nillable, Sort
Description
Indicates whether a user has delete access to the record (true) or not (false).
HasEditAccess
Type
boolean
Properties
Defaulted on create, Filter, Nillable, Sort
Description
Indicates whether a user has edit access to the record (true) or not (false).
HasTransferAccess
Type
boolean
Properties
Defaulted on create, Filter, Nillable, Sort
Description
Indicates whether a user has transfer access to the record (true) or not (false).
HasReadAccess
Type
boolean
Properties
Defaulted on create, Filter, Nillable, Sort
Description
Indicates whether a user has read access to the record (true) or not (false).
MaxAccessLevel
Type
picklist
Properties
Nillable, Sort
Description
Indicates a user’s maximum level of access to a record.
Valid values are:
  • None
  • Read
  • Edit
  • Delete
  • Transfer
  • All
RecordId
Type
picklist
Properties
Filter
Description
ID of the record.
UserId
Type
reference
Properties
Filter
Description
ID of the user.

Usage

Use this object to query a user’s access to records. You cannot create, delete, or update any records using this object. Executing a SOQL SELECT query returns results for existing records to which the querying user has read access.

You can check access to records by querying on the access and the maximum access level.

The following sample query returns the records and whether the queried user has read and transfer access to each record, and the user’s maximum access level to each record.

SELECT RecordId, HasReadAccess, HasTransferAccess, MaxAccessLevel
     FROM UserRecordAccess
     WHERE UserId = [single ID]
     AND RecordId = [single ID]      //or Record IN [list of IDs]

The following query returns the records for which a queried user has read access to.

SELECT RecordId
     FROM UserRecordAccess
     WHERE UserId = [single ID]
     AND RecordId = [single ID]      //or Record IN [list of IDs]
     AND HasReadAccess = true

When the running user is querying a user's access to a set of records, records that the running user does not have read access to are filtered out of the results.

SOQL restrictions:
  • When filtering by UserId and RecordId only, you must use SELECT RecordId and optionally one or more of the access level fields—HasReadAccess, HasEditAccess, HasDeleteAccess, HasTransferAccess, and HasAllAccess. You may include MaxAccessLevel.
  • When filtering by UserId, RecordId, and an access level field, you must use SELECT RecordId only.
  • May include an ORDER BY clause. You can ORDER BY any field that is being selected in the query.
  • The number of record IDs that can be queried is limited to 200.
© Copyright 2000–2013 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.