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
Mohd ImranMohd Imran 

How to restrict the access of records to the user at same level.

Hi,
There is a object and OWD for this object is set to Public.
There are two users A and B, both users are at the same lavel in Role Heirarchy and have access to the records.
Here requirement is I dont want to provide the record access(restrict the access) to user A, where as user B should have the access for the same.
Please guide me to achieve this....any kind of help would be highly appreciated.
 
Anupama SamantroyAnupama Samantroy
Hi Mohd Imran,

Sharing rules comes in picture when the OWD is restrictive. In your case you have the OWD as public which makes the record accessible to anyone regardless of what you do. I would suggest change the OWD to private and then write a sharing rule to share the record between users.

Thanks
Anupama
Mohd ImranMohd Imran
Thanks Anupama for your quick response...
I have been asked to achieve this when OWD is public only. Sharing rule is one of the solution if OWD is private. Is there any way to restrict the user while OWD is public???
One more thing, In this case can I go with permission sets???
As per my knowledge permission sets are used only to improve the access, not to restrict to
Anupama SamantroyAnupama Samantroy
Hi Mohd Imran,

I dont think there is a way to restrict the records when the OWD is Public. 
Alternatively you can change the OWD to Public Read Only and then write a sharing rule to give the edit permission to User B.

--Permission Sets are like profiles where you can give object level access but we need record level access so, thats not the right solution. 

Thanks
Anupama
Nitin SharmaNitin Sharma
Hi Imran,

You can not restrict record while OWD is public. Because OWD is base line access in salesforce . Make Owd is private and both user on same level.
Why you want to go for out of the box while u can achive this by simple point and click. All the sharing rule, permission set are useing when we want to give eccess not for restrict. 

Thanks,
Nitin Sharma
Mohd ImranMohd Imran
Thanks Nitin for your response.
I had an interview, there interviewer asked this question to me. I replied the same that if OWD is private then sharing rule is the solution.
But he told, there is a way to acheive this while OWD is public also.
This was the reason I posted this question because I could not find the way restrict the user while OWD is public.

Regards,
Mohd Imran