function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ankit SatnalikaAnkit Satnalika 

Help me with SOQL Query

I need the list of users who all are having edit access to a record from Account object.
Can anybody help me with the SOQL query.
Raj VakatiRaj Vakati
You need to use UserRecordAccess .. 


https://salesforce.stackexchange.com/questions/107519/how-to-query-users-who-have-access-to-a-particular-record


https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_userrecordaccess.htm?search_text=UserRecordAccess
https://success.salesforce.com/answers?id=9063A000000l3E0QAI

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
  • 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.
  • 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 includeMaxAccessLevel.
  • When filtering by UserId, RecordId, and an access level field, you must use SELECT RecordId only.