Use this object to query a user’s access to records. You can’t create, delete, or update any records using this object.
Up to 200 record IDs can be queried. You can include an ORDER BY clause for any field that is being selected in the query.
The following sample query returns the records, 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 to which a queried user has read access.
SELECT RecordId FROM UserRecordAccess WHERE UserId = [single ID] AND RecordId = [single ID] //or Record IN [list of IDs] AND HasReadAccess = true
Using API version 30.0 and later, UserRecordAccess is a foreign key on the records. You can’t filter by or provide the UserId or RecordId fields when using this object as a lookup or foreign key. The previous sample queries can be run as:
SELECT Id, Name, UserRecordAccess.HasReadAccess, UserRecordAccess.HasTransferAccess, UserRecordAccess.MaxAccessLevel FROM Account
SELECT Id, Name, UserRecordAccess.HasReadAccess FROM Account