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
LinThawLinThaw 

How can I get Users who can access the current record from apex?

Hi there,
How can I get users who can access the current record from apex,
look like this standard Sharing Hierarchy Page as below.
User-added imageIs there easy way to get them rather than using shared object, group, groupmember and userrole.
Thanks for any suggestion.
Regards,
LinThaw
SwethaSwetha (Salesforce Developers) 
HI LinThaw,
Have you tried to query the object directly with something like 

SELECT Id, Name, UserRecordAccess.HasReadAccess, UserRecordAccess.HasTransferAccess, UserRecordAccess.MaxAccessLevel FROM Account

Reference: https://salesforce.stackexchange.com/questions/175/can-i-find-out-if-the-current-user-has-access-to-a-record-without-querying
LinThawLinThaw

Hi Swetha,
That query is for current user access for the account record.
I want to get all users who have access the account record.