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
SUMAN KUMARI 70SUMAN KUMARI 70 

How to restrict a user to view only a particular record type

Hi All,
I have a business requirement where I want a particular record to be viewd by system admin only and no other user should be able to view the record. Even if the other user knows the record number, he should get an error when trying to open that particular record.

Is there any out of box functionality provided by the salesforce to achieve this? 
Thanks a lot for your help in advance.

Thanks,
Suman
Abhishek BansalAbhishek Bansal
Hi Suman,

You can create a new record type and enable it for system admin profile only. Whenever you want to create a record that should be visible to admin only then choose this new record type. Other users will not be able to those records as they don't have access to that record type.

Let me know if you need more information or help on this.

Thanks,
Abhishek Bansal.
David Zhu 🔥David Zhu 🔥
Salesforce won't prevent users from viewing different record type records.
But you may set the object OWD as private and use sharing rules to implement that.
Abhishek BansalAbhishek Bansal
Hi David,

Yes you are right. Record type will not prevent the users from viewing the recods so the only option is to set the OWD as Private and than use the sharing rules.

Thanks,
Abhishek Bansal.
SUMAN KUMARI 70SUMAN KUMARI 70
Hi Abhishek/David,

Isn't there any way by using workflow rule or process builder we can achieve this?

Thanks,
Suman
Andrew GAndrew G
Out of the box - OWD to private.   Then configure sharing rules.  You could do something like a checkbox in the record that needs to be clear for the record to be shared.  The System Admin could then set the checkbox when creating the record.  

Process builders/workflows do things to records,  they don't necessarily hide them.  You could play with having a process builder update the checkbox, but you will still need to setup the OWD and sharing rules. 

regards
Andrew