I have a few Accounts, Contacts, Opportunities and a custom object to be accessible only to a group of users. All other Accounts/Opps/Contacts/Custom Objects are to be accessible by all users.

The OWD is currently public

  • OWD public means you can't take away read privileges. Switching from OWD Public to Private can be a huge undertaking involving lots of regression testing – cropredy Aug 8 '16 at 22:35

With standard detail page you can't restrict user to access specific account so as a solution you can follow below steps.

  1. Create one checkPermission visualforce page.
  2. Inside action method put your logic to check whether that group of users has access to that account or not. You can store such users or account inside custom metadata or custom setting.
  3. If group of users has permission redirect them to standard detail page else redirect them to another noPermission visualforce page.
| improve this answer | |
  • mmm.. really we have only a apex solution? i know there is something with criteria based sharing – Prady Aug 8 '16 at 19:12
  • your OWD is public in that case you will not get sharing option – Himanshu Aug 8 '16 at 19:13
  • We could change it to private but not sure of the implications of it – Prady Aug 8 '16 at 19:14
  • You can use sharing rules to grant wider access to data. You cannot restrict access below your organization-wide default levels. – Himanshu Aug 8 '16 at 19:14
  • 1
    Himanshu -- this sort of works but won't prevent access via reports or list views – cropredy Aug 8 '16 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.