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
John PeterkinJohn Peterkin 

how do i restrict users to view only their own records

Lokesh KumarLokesh Kumar
Hi John,

yes, If you have your OWD on accounts and opportunities as Private you can restrict them from viewing accounts and opportunities of others. Please also make sure they do not have Either View All or Modify all data On the CRUD (Profile permissions) and at the leads have read permission.

Thanks,
Lokesh
Tarun J.Tarun J.
Hello John,

You can set Org-Wide Default access as 'Private' for the object. Also, if it is custom object and you can also restrict record visibilty by Role Hierarchy. Uncheck the 'Grant Access Using Hierarchies' option to restrict the access by Role Hierarchy.

User-added image


-Thanks,
TK

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Deepali KulshresthaDeepali Kulshrestha
Hi John,

I have gone through your problem you can restrict user by to see there own record by following steps given below:

1:- From Setup, enter Sharing Settings in the Quick Find box, then select Sharing Settings.

2:- Click Edit in the Organization-Wide Defaults area.

3:- For each object, select the default access you want to use. 

4:- 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.

5. Below the Organization-Wide Defaults area there object sharing rules.

6. You can create sharing rules on the object you.

7. At the time of creating a sharing rule there three checkboxes:-

    rule type ---> Based on record owner.

    Object:owned by member select ---> roles

    share with ---> 

    Object Access ---> Read only.
    
    
visit for reference:-- https://help.salesforce.com/articleView?id=sharing_model_fields.htm&type=5

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

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

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

https://help.salesforce.com/articleView?id=security_data_access.htm&type=5
    
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com 
Aaron MosseyAaron Mossey
Very Helpful Deepali,

I have a scenario with two main profile groups.  How do I set this up if group A should have public read/write access to a custom object while group B should have private read/write access to the same object where they can only see their records and their managers can see records for their team via role hierarchy?
Aaron MosseyAaron Mossey
Update: In any scenario where a custom object is to be private for a certain profile group you must:
  1. Set the object OWD to private (this solves for the profiles that should only see their own records)
  2. In the profiles that should ignore the OWD, set the object permissions (on each profile) to "View All"
When setup correctly, the sharing settings of the object will list as private and you will be able to see all profiles ignoring the OWD listed in "Profiles That Override Budget Sharing" section of the sharing settings for that object.