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
Kevin McAuliffe 14Kevin McAuliffe 14 

Validation Rule on Sharing Rules?

Hello,

We would like to eliminate the possibility of accidentally creating a scenario where a customer can view another customer's data in a Customer Portal.  We've discovered one way this could happen is by creating a sharing rule where records are shared with a Role + Internal and Portal Subordinates.   Validation rules and Apex Triggers can only trigger on sObjects, as I understand it, so I don't think either of those options would work

Are there any other options we could pursue to restrict the options on sharing rules?

Thank you.
Manisha Nundloll-RiceManisha Nundloll-Rice
You cannot use a Validation Rule for viewing a record, validation rules are fired on record 'save'. To solve the view problem, you could overwrite the record detail page with a custom visualforce page and use the action method in the VF page to run any validation.