Manual Record Sharing In Salesforce Lightning

Did you know that in Lightning Experience, the button to share a record is impossible to add on any page layout? That is correct, if you use a private sharing model and want to manually share a record with other users, you’re expected to switch to classic to do so and then back to lightning.

I have created a simple workaround which allows you to have a button (technically an action) on a lightning page layout that will let you manually share a record as you could in classic. This entire process will take you less than 5 minutes.

Step 1: Go to Visualforce Pages in your Salesforce settings, create a new page

  • You can name it whatever you want, I named mine “Sharing”
  • The code is simple:

<apex:page StandardController=”YOUR OBJECTS API NAME” action=”{!URLFOR($Action.YOUR OBJECTS API NAME.Share,YOUR OBJECTS API NAME.Id)}”>

Replace my fillers with the API Name of your object for example “Opportunity” or “Custom_Object__c”

Now save the Visualforce page.

Step 2: Once you save, you’ll be returned to the list view of your Visualforce pages. Click Security next to your Visualforce page and add all the profiles you want to be able to manually share. I added them all for the sake of not running into accessibility issues.

Step 3: Go to the object setting that you created this Visualforce page for and find the Buttons, Links, and Actions section. Click New Action

  • Simply mimic what I did below
  • Save this action

Step 4: Go to your page layout(s) and add this action to the Salesforce1 and Lightning Experience Actions section. Save your page layout.

Voila! You now have a share button at the top of your lightning record page. Clicking it will bring you to the manual sharing page you’re used to in classic.

The workaround is successful.



Author: Brenden Santoro – Salesforce Consultant, GSD New York Office