2

I have partner community enabled. I want to display Account, Contact and Opportunity records to the Community users only if they fulfill particular criteria.

What I've already done is as follows :

Setting the OWD as private for Account, Contact and Opportunity objects.

Created Sharing Rules for Account, Contact and Opportunities.

enter image description here

The issue that I've been facing is :

There are multiple views on these objects. And all the records are coming up to the site users, instead of them not fulfilling the criteria of the sharing rule.

5
  • 1
    Have you set the external OWD values to the same as the internal OWD values? Do your Partner User Profiles have Roles configured for them? If not, you won't be able to use Criteria Based Sharing.
    – crmprogdev
    Commented Sep 2, 2017 at 13:24
  • 1
    Yes all the OWD have been set to private, for both internal and external users. And roles are assigned automatically after enabling the contact as a partner. I want you to please tell me what did you mean by "Profiles and Roles Configured", maybe that is the only pain point. Commented Sep 4, 2017 at 7:52
  • 1
    Have you checked for implicit sharing rules? Run the following query in developer console, using one of your portal users' Id: SELECT Id, UserOrGroupId, AccountId, RowCause FROM AccountShare WHERE UserOrGroupId = '005240000053ddGAAQ'. Have a look at the RowCause to see why that user can see so many accounts.
    – Aidan
    Commented Sep 4, 2017 at 9:03
  • 1
    Hello Adian, the RowCause is coming up to be Owner. Commented Sep 4, 2017 at 9:54
  • "The issue that I've been facing is : There are multiple views on these objects. And all the records are coming up to the site users, instead of them not fulfilling the criteria of the sharing rule." I have seen this issue that if user has read permission then he can view all records in the list regardless sharing but as he clicks on any record he gets insufficient privileges. Are you facing same behavior or something different?
    – Ayub
    Commented Sep 7, 2017 at 6:19

2 Answers 2

2
+50

The Profile that you have the partners assigned to, does that have View All/Modify All for the concerned objects? Or does it maybe even have the system permission View All Data or Modify All Data?

A RowCause of Owner might indicate that the user has View/Modify All Data.

Instead of using a query to get the RowCause, use the Sharing button to determine the access to a record, this has sometimes a more clearer description (And sometimes not)

When having clicked on the Sharing button, if you do not see the concerned users directly, click on Expand List, find the user who you think has unexpected access, and click on Why in front of their name.

8

What you're attempting to create are Criteria-Based Sharing Rules. Unfortunately, you can't share records with your partners using criteria-based sharing. Instead, you can only share records based on their Role, not values in the record itself unless you use Apex Managed Sharing.

In order to share records with Partners in the Community based on record attributes, you'll need to implement Apex Managed Sharing. You'll want to use a trigger to select the records that you wish to share with a Partner Community Member. Once you've selected a record, there are several different methods to complete the rest of the Apex Managed Sharing calculations. You'll find plenty of posts here on SF.SE on how it's done as well as good documentation too.

4
  • Hello @crmprogdev, But how come my Organization wide default settings, which have been set to private, are not restricting the community users from viewing the records. Currently, the community users are viewing records as if they are the System Admin. Commented Sep 5, 2017 at 9:10
  • 1
    I don't know what other sharing rules you have in place. It could be that the current sharing rule you've written is being interpreted as a "share all" rule instead of a conditional sharing rule. You're sharing the records with "All Partner Users", not users associated with the Account by Role in the Hierarchy or as Partners who are Owners of the Account. Partner Community sharing is different than Customer Community Sharing.
    – crmprogdev
    Commented Sep 5, 2017 at 11:48
  • I had managed to create apex managed sharing by creating triggers on Account, Contact and Opportunity objects, But even they didn't work out to show only criteria based records to the users. Commented Sep 7, 2017 at 10:15
  • 1
    Without seeing your code, I couldn't comment or advise. The triggers should select the records based on the criteria. The records should then be shared based on a sharing reason that you've defined like MyReasonName__c, not using a Row Cause of Owner. Make certain you're sharing to specific users and not to a Group unless you want everyone in the Group to see the record. See Sharing a Record Using Apex.
    – crmprogdev
    Commented Sep 7, 2017 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .