Friday, 25 January 2019

How to check whether user has access to a particular record or not?

Query “userRecordAccess” to check whether has access to record or not.


For example:

SELECT RecordId, HasReadAccess, HasTransferAccess, MaxAccessLevel, HasAllAccess, HasDeleteAccess, HasEditAccess FROM UserRecordAccessWHERE UserId = “005xxxxxxxxx”AND RecordId = “001xxxxxxxx”

HasAllAccess Indicates whether a user has all access–read, edit, delete, and transfer—to the record (true) or not (false).

HasReadAccess, HasEditAccess , HasDeleteAccess ,HasTransferAccess return Boolean value.

MaxAccessLevel return access level like None, read, Edit,Delete,Transfer and All.