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
Girish Reddy 52Girish Reddy 52 

How to restrict two users from looking each others record when they are under same profile ?

Best Answer chosen by Girish Reddy 52
VinayVinay (Salesforce Developers) 
Hi Girish,

You can restrict user by to see there own record using Sharing settings.

> Enter Sharing Settings in the Quick Find box, then select Sharing Settings.
> Edit in the Organization-Wide Defaults area.
> For each object, select the default access you want to use. 
> To allow employees at higher levels in the role hierarchy to access records automatically,
> Select Grant Access Using Hierarchies for any custom object that does not have default access of Controlled by Parent.

References:
https://help.salesforce.com/articleView?id=sf.security_data_access.htm&type=5
https://help.salesforce.com/articleView?id=sf.managing_the_sharing_model.htm&type=5
https://help.salesforce.com/articleView?id=sf.security_sharing_owd_default_settings.htm&type=5

Please mark as Best Answer if above information was helpful so that it can help others in the future.

Thanks,

All Answers

VinayVinay (Salesforce Developers) 
Hi Girish,

You can restrict user by to see there own record using Sharing settings.

> Enter Sharing Settings in the Quick Find box, then select Sharing Settings.
> Edit in the Organization-Wide Defaults area.
> For each object, select the default access you want to use. 
> To allow employees at higher levels in the role hierarchy to access records automatically,
> Select Grant Access Using Hierarchies for any custom object that does not have default access of Controlled by Parent.

References:
https://help.salesforce.com/articleView?id=sf.security_data_access.htm&type=5
https://help.salesforce.com/articleView?id=sf.managing_the_sharing_model.htm&type=5
https://help.salesforce.com/articleView?id=sf.security_sharing_owd_default_settings.htm&type=5

Please mark as Best Answer if above information was helpful so that it can help others in the future.

Thanks,
This was selected as the best answer
Girish Reddy 52Girish Reddy 52
Hi Vinay, 

I tried this as you said and records where hidden successfully, But I got another problem as these two users are reporting to higher role on role hirarechy, He is unable to view both the users records. Can you please say me where am I going wrong.

ps: I have ticked check box on grant role hirarechy in the owd 
VinayVinay (Salesforce Developers) 
If you disable the Grant Access Using Hierarchies option, sharing with a role or territory and subordinates only shares with the users directly associated with the role or territory selected. Users in roles or territories above them in the hierarchies won’t gain access.

Check below reference for more details.

https://help.salesforce.com/articleView?id=sf.security_controlling_access_using_hierarchies.htm&type=5

Thanks,