Activity Forums Salesforce® Discussions How to return all users that have access to a specific record in Salesforce?

  • Anurag

    Member
    August 28, 2018 at 12:44 pm

    Hi Anjali,

    You can use userRecordAccess object to check CRUD permissions..

    So pass the recordId and userId.. to check that user having what type of access on that record..

    you can check variables like HasDeleteAccess. If HasDeleteAccess true means user have delete access. If false then user don't have access..

    Based on these accessibility perform DML..

    List<UserRecordAccess> lstUserRecordAccess = [SELECT RecordId,MaxAccessLevel,HasAllAccess,
    HasDeleteAccess,
    HasEditAccess,
    HasReadAccess,
    HasTransferAccess
    FROM UserRecordAccess
    WHERE UserId = '00550000000rlrX'
    AND RecordId = '0015000000TaWdI'];

  • Parul

    Member
    September 23, 2018 at 9:00 am

    you can check variables like HasDeleteAccess. If HasDeleteAccess true means user have delete access. If false then user don’t have access..
    Based on these accessibility perform DML..

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos