Sharing Sets were added to Customer Community Plus and Partner Community Licenses in the Winter ’19 release. With this update, enabling sharing inside those Community types has become much easier.
Sharing Sets let you take a Lookup (typically Account, Contact, or User) from the Community User, and match it to records in your Salesforce Org that also have that Lookup value. For instance, below we are sharing all Projects that have an Account that matches the Community User’s Account.
You might be thinking, “That was really cool, but I have a complex sharing scenario that isn’t an all-or-none scenario?”
You are able to expand this by adding some creativity with a “backend only” Lookup for the Object. You can conditionally fill this field out using the automation tool of your choice (typically, I use Process Builder). By then setting your Sharing Set up to use this conditional Lookup instead of the one you are using internally, you’re now sharing just the records you want to share!
Make sure you are very clear with the name of this backend field so that Admins and Users are not confused if they see it.
What if you have complex Account hierarchies?
Not to fear! Account Contact Relationship saves the day. If the Contact has a match with any of their Accounts you can grant access via the Account (if that is how you want to share the record). I always look to enable this to future proof an implementation, instead of having to adjust your sharing down the road. Another benefit of using Account Contact Relationships is that it allows you the ability to expand your sharing with one off scenarios outside of an Account’s hierarchy.
Let’s now go through the setup of sharing Projects conditionally in a Sharing Set using Related Accounts and a conditional Lookup for the Account.
In this example, we are assuming that your Lookup Field and the Automation to populate that are already setup.
Sharing Sets are something people often overlook, and can seem hidden if you are not experienced with Communities. To access your Sharing Sets, go to Setup –> Communities Settings –> Sharing Sets.
Once you have selected the Profile(s) you want this Sharing Set to apply to, you can select the Objects you want to grant sharing on.
NOTE – The list of available objects is based on an object’s Sharing Settings for External Users in your Org.
We first have to grant access to the User (Community User) based on what field. In this scenario, we are going to be using Contact.RelatedAccount to share records.
We want to now select the Lookup to match with the Contact.RelatedAccount (which is all of the Accounts they are associated to).
This is what the access mapping should look like before we hit Update. Note, these mappings are not saved until you hit Save in the Sharing Set.
After hitting Update, you will see that we have successfully configured the Project’s access for this Sharing Set. Repeat this for the
This expanded usage of Sharing Sets should solve most Community related sharing scenarios. If you have anything more complex there is always automated Manual Sharing via Apex or PB+Flow that you can fall back on, but try to utilize Sharing Sets when possible!