S-Docs can be used in Salesforce communities too! In this guide, we will be setting up this functionality for a particular Salesforce object (you will need to follow the steps in this guide for each object you are enabling S-Docs with communities for). To do so, all we have to do is create a button that will show up for your community users and add it to an object’s page layout.

communities 01
This button is not unique to communities; it will also exist in our production org and operate exactly the same as an ordinary S-Docs button. This means if we already have an S-Docs button, we will be replacing it with a new button that can be used by community users as well as users in our production org.

communities 02

Step 1: Create the S-Docs for Communities Button

In this step, we will be creating a button that will enable the use of S-Docs with Salesforce communities for a particular object. In this example, we will be creating the button for an opportunity.

  1. You will first need to navigate to the “Buttons, Links, and Actions” page for the Salesforce object you would like to create a communities button for.

If you’re creating the button for a custom object, please follow the instructions for part (a) and skip the instructions in part (b). If you’re creating the button for a standard object, please skip the instructions in part (a) and follow the instructions in part (b).

a.) Creating the button for a custom object.

Navigate to Setup > Build > Create > Objects.

communities 03
Find the name of the custom object you would like to create the button for and click the name of this object (do not click the edit button). In this example, we will be creating the button for the Check object, a custom object representing the data for a standard business check.

communities 04
Next, a page will display for your custom object. Please take note of the API Name at this point, as you will require it in later steps. The API Name is often just the “Object Name” appended with __c (note the two underscores), but sometimes this is not the case, so please take note of that here. In the case of our custom Check object, we will note that our API Name is Check__c.

communities 05
On the page for your custom object, scroll down to “Buttons, Links, and Actions” and click “New Button or Link”.

communities 06
This concludes part (a).

b.) Creating the button for a standard object.

Navigate to Setup > Build > Customize > YourObjectNameHere > Buttons, Links and Actions. In this example, we will be finding the “Buttons, Links, and Actions” page for an Opportunity.

communities 07
Once you’re on the “Buttons, Links, and Actions” page for your standard object, click “New Button or Link”.

communities 08
This concludes part (b).

  1. We will now complete the “New Button or Link” page. Here is how the finished page might appear:

communities 09
Here’s what to fill in:

Label: Create Documents (S-Docs)

Name: Create_Documents_S_Docs

Display Type: Detail Page Button

Behavior: Display in existing window without sidebar or header

Content Source: URL

Finally, paste the following code into the “Custom button or link editor”. Note that “ChangeToYourObjAPIName” appears twice in this code; you will need to change it to the API name for the object you are creating a button for.

{!URLFOR($Site.BaseCustomUrl+'/'+
SUBSTITUTE($Site.Prefix, '/', '') +
IF ( OR(ISBLANK($Site.Prefix),$Site.Prefix='') ,
'apex/SDOC__SDCreate1?id='+ChangeToYourObjAPIName.Id+'&Object=ChangeToYourObjAPIName&site='+IF(ISBLANK($Site.Prefix),'DEFAULT',$Site.Prefix),
'/apex/SDOC__SDCreate1?id='+ChangeToYourObjAPIName.Id+'&Object=ChangeToYourObjAPIName&site='+$Site.Prefix))}

Again, please make sure that both appearances of “ChangeToYourObjAPIName” have been changed to your object’s API name. Click “Save” to finish the button.

 

Step 2: Add the S-Docs for Communities Button to the Page Layout

Now, all we have to do is add the button we just created to our object’s page layout.

  1. You will first need to navigate to the “Page Layout” page for the Salesforce object you would like to add the button to.

If you’re creating the button for a custom object, please follow the instructions for part (a) and skip the instructions in part (b). If you’re creating the button for a standard object, please skip the instructions in part (a) and follow the instructions in part (b).

a.) Adding the button to a custom object’s page layout

Navigate to Setup > Build > Create > Objects.

communities 10
Find the name of your custom object and click the name of this object (do not click the edit button). In this example, we will be adding the button to a Check’s page layout.

communities 11
On the page for your custom object, scroll down to “Page Layouts” and click “Edit” next to “YourObjectName Layout”.

communities 12
This concludes part (a).

b.) Creating the button for a standard object.

Navigate to Setup > Build > Customize > YourObjectNameHere > Page Layouts. In this example, we will be finding the “Page Layouts” page for an Opportunity.

communities 13
Now click “Edit” next to “YourObjectName Layout”. (There may be other layouts, such as “YourObjectName Layout SDoc”. Do not edit these; only edit “YourObjectName Layout”).

communities 14
This concludes part (b).

  1. Now we can add the button to the page layout. Drag the button you created in Step 1 into the “Custom Buttons” box. If there is already an S-Docs page button here, you may remove it from the “Custom Buttons” box by dragging it into the toolbar you pulled you “Create Documents (S-Docs)” button from. Your new button works the same as the old S-Docs button, except now it can be used by communities in addition to users within your production org.

communities 15
Here’s how the finished page will appear.

communities 16
Click “Save” and you’re all done! You should now have an S-Docs button on your object’s page that can be used by users in your communities, as well as users in your production org.