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.

  • 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 Sep 2 '17 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. – Shobhit Saxena Sep 4 '17 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 Sep 4 '17 at 9:03
  • 1
    Hello Adian, the RowCause is coming up to be Owner. – Shobhit Saxena Sep 4 '17 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 Sep 7 '17 at 6:19
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.

  • 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. – Shobhit Saxena Sep 5 '17 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 Sep 5 '17 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. – Shobhit Saxena Sep 7 '17 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 Sep 7 '17 at 13:39

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.