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
Big EarsBig Ears 

Query for all users with access to a particular record

Hey all,

Is there a way to reliably return a list of all Users with a particular level of access to a particular record?
  • UserRecordAccess looked useful, but the use case seems to be about returning a number of records that pertain to a single user's access
  • CustomObject__Share could work, but then this can contain groups (which can be nested) so that can result in multiple queries

Is there a recommended approach?

With thanks, Andy.

sandeep@Salesforcesandeep@Salesforce
Hi Andy, 
List<id> listofIds = new List<id>();
for(Accountshare acs : [select id,UserOrGroupId  from AccountShare Accountid = 'YOUR_ACCOUNT_ID'])
{
    listofIds.add(acs.
}


Questing AccountShare we can fetch list of mix (user and groups ) and then please follow below response 
https://developer.salesforce.com/forums/?id=906F00000008yBGIAY

Thanks
Sandeep Singhal