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
Sanjana Deenamsetty 10Sanjana Deenamsetty 10 

Regarding profiles and record access permissions

Hello Everyone,
Help needed on this below situation.
Our Organization has 2 public groups-
  1. All internal users group – This group has all the users in the organization
  2. Private accounts and contacts access group – This group has only few users in it.
*All these users belong to different profiles.
We use a private check box on the accounts which will lock down the related contact and Opportunity when the checkbox is checked true. As per the account sharing settings only the private accounts and contacts public group will be able to access these private accounts.
But as per the situation in the organization we would like to provide access to some of the users from different profiles to view the Name , Email fields and some of the related lists that belong to these Private accounts and as usual they should be able to access all the fields on the normal contacts and accounts. Since every user in the organization will enter data into salesforce.
 
Please suggest if this is possible through development of any visual force pages or any suggestions would help.
 
Thank you!!

 
 
harshadeepthi kharshadeepthi k

Hello Sanjana,

According to the given scenario, you can create record type based on the profile & roles. So that they can access the fields required.

Hope this works,

Regards,

Harsha Deepthi K.

Sanjana Deenamsetty 10Sanjana Deenamsetty 10
Hi Harsha deepthi,

Thank you for the response. 
We actually thought of this option too. But the problem is with contacts we would duplicate the contacts which are private by creating them in two different record types.
We would like to give access to the user who are not part of the private accounts and contacts group to view just few fields on these private accounts and contacts.

Thank you,
Sanjana
Sudhir gonuguntlaSudhir gonuguntla
Hello 

We can write apex sharing to provide access to certain records for public groups 
 
=============== Sharing Handler ==================

 public static void shareProjectVersionRecords(List<GenericMethods.SharingWrapper> sharingRecordsList) {
        List<Project_Version__Share> shareRecordsList = new List<Project_Version__Share>();
        for(GenericMethods.SharingWrapper sharingRec : sharingRecordsList){
            shareRecordsList.add(new Project_Version__Share(ParentId=sharingRec.parentId, userOrGroupId=sharingRec.userOrGroupId, AccessLevel=sharingRec.accessLevel, RowCause=sharingRec.rowCause));
        }
        List<Database.SaveResult> sr = Database.insert(shareRecordsList,false);
    }

=============== Sharing Wrapper =================

public class SharingWrapper {
        public Id parentId;
        public Id userOrGroupId;
        public String accessLevel;
        public String rowCause;
        
        public SharingWrapper (Id parentId, Id userOrGroupId, String accessLevel, String rowCause) {
            this.parentId = parentId;
            this.userOrGroupId = userOrGroupId;
            this.accessLevel = accessLevel;
            this.rowCause = rowCause;
        }
    }