S-Docs works great with the custom objects and even the Force.com platform edition, which is entirely comprised of custom objects. S-Docs allows you to generate a variety of outputs that can merge Salesforce data from both standard and custom objects. Your documents can span many relationships to include data from formula fields, rich text, parent records, child, grandchild and related objects all within the same document. In addition, using the S-Docs template editor allows you to design the final output using an easy WYSIWYG editor. Finally, you can easily email your finished documents directly from salesforce and have the entire interaction captured seamlessly as an activity.

Since every organization creates different custom objects to meet their unique requirements, you need to configure S-Docs to recognize which custom objects you want to leverage with S-Docs.

For the purposes of this guide, we assume your custom object is named CustomObj and has an API name of ChangeToYourCustomObj__c. (Note: the API name has two underscores.) S-Docs can also integrate with other AppExchange apps (note: there are a few setup differences). This document will walk you through the step-by-step configuration process and includes many illustrations. It is intended for salesforce.com administrators who are familiar with standard configuration tasks.

As a note, S-Docs does not use traditional templates (e.g. existing MS Word .dot or PDF files), but rather you design your template and define your merged fields all within Salesforce S-Docs Template records. Each time a user generates a document, the S-Docs engine merges the template record with your salesforce custom object record data and delivers the merged document all within the force.com platform. There is no need to have a shared network drive or an external document repository nor the need for connectors, macros or any downloads. You don’t need to log into any other system, share credentials or pass your data to any external servers. It is all self-contained on the force.com platform.

To take advantage of S-Docs with custom objects you will need to complete the following salesforce configuration steps:

  • Add “ChangeToYourCustomObj__c” as an available picklist value for your S-Docs Templates
  • Create a lookup field named “ChangeToYourCustomObj__c” (note the two underscores) on the SDoc Relationship object - this allows S-Docs records to be linked to your custom object records
  • Create an S-Docs button and place it on your CustomObject’s page layout – this enables users to initiate the document generation process
  • Create your first template- where, as an admin, you design your document layout using the WYSIWYG editor and define what salesforce data you want to merge

Detailed instructions are provided below. Sample templates can be found here.

Note: This guide details configuring S-Docs in Salesforce Classic. Although the setups are fairly similar, please reference this documentation for more information regarding S-Docs in Salesforce Lightning.

STEP 1: Add Your Custom Object ApI Name  to "Related to type" field on the "SDoc Template" object:

  1. Click on setup link (found on at top-right corner of your salesforce homepage)step1-sdocs
  2. Click App Setup➤Create➤Objectstep 1-sdocs-1
  3. Click on the "SDoc Template" link (not the edit link) step1-sdocs-2
  4. Click on the "Related to Type" link ( found under "custom fields and relationships" section). Don't click on edit or replace links.step 1-sdocs-3
  5. Scroll down to "Picklist Values" section and click on the new buttonstep 1-sdocs-4
  6. Add your custom object’s API name (e.g. ChangeToYourCustomObj__c)  as a picklist value, then click Save.  *Note: if you are using S-Docs with another AppExchange managed package, then your custom object API name should include the domain name of the package followed by two underscores and then the object name (e.g. package__ChangeToYourCustomObj__c). You should use the entire API name for the S-Docs picklist value.

step 1-sdocs-6

You should substitute your object’s API name (not use the example ChangeToYourCustomObj__c shown above)

STEP 1b: Confirm you can create a template using your Custom Object:

You should now be able to create a template and choose your custom object (e.g. ChangeToYourCustomObj__c) from the picklist in the "Related to type" field. Make sure that "Available for use" and "Initially Visible" checkboxes are checked.

STEP 2: Add a lookup field to allow relationship linking:

This step allows you to associate the S-Doc with the Custom object, so that users can see a related list of all S-Docs created on your Custom Objects page layout.

  1. Click Setup ➤ App Setup➤ Create ➤Objects
  2. Select SDOC_Relationship
  3. Under Custom Fields and Relationships click "New Button", you will enter the new field wizard:

Step 1 of 6 - Pick "Lookup Relationship" click next
Step 2 of 6 - Select your Customer Object (e.g. ChangeToYourCustomObj__c) from picklist values, then click next
Step 3 of 6* - Field label and field name should be your custom object name without the “__c”.  In our example it would be "CustomObj". Click next
Step 4 of 6 - Checkbox should be visible for all users
Step 5 of 6 - Checkbox should add the field for the layout
Step 6 of 6 - accept default, click "Save" button

*Note: If you are using S-Docs with another AppExchange managed package – your field name in step 3 above will need to accommodate for the double underscore in the field name, which is not allowed by Salesforce.  Since your API name includes the domain name of the package followed by two underscores and then the object name (e.g. package__ChangeToYourCustomObj__c), you will need to replace the first double underscore with “_u_” and remove the remaining “__c”. In our example, your field name should be set to: package_u_CustomObj.

STEP 3: Create a button to place it on your Custom Object page Layout:

Just like using S-Docs with other objects, you need to place an S-Docs button on the record detail page layout. Users click the button to initiate creating a document from the record detail page.

Step3a: Create the S-Docs button

  1. Go to Setup ➤ App Setup➤ Create ➤Objectsstep-3-1
  2. From the list of custom objects, click on your Custom Object link. Do not click on the “edit” link.step-3-2
  3. From the custom object definition page, scroll down to “Custom Buttons and Links” related list, and click on the “New” Button step-3-3
  4. Type the button Label (e.g. "S-Docs")
  5. Display Type: choose Detail Page Button
  6. Choose a Behavior (we recommend 'Display in existing Window with Sidebar')
  7. Content Source: Choose URL
  8. *Use the following URL without quotes (note that double underscores are used in two places) :
    /apex/SDOC__SDCreate1?id={!CustomObj__c.Id}&Object=CustomObj__c

    *Note: If you are using S-Docs with an object within another AppExchange managed package – your button syntax should include the entire object API name that includes the domain (e.g. package__ChangeToYourCustomObj__c). Note that that double underscores are used throughout. Your button syntax should therefore look similar to the following:

    /apex/SDOC__SDCreate1?id={!package__CustomObj__c.Id}&Object=package__CustomObj__c
  9. *Optional* You can have users save clicks by enabling the “One-Click” feature. Enabling this will bypass the document creation wizard. An administrator simply needs to change the button definition to include a list of preselected S-Docs template ids that will be automatically generated. Placing this button will let users create the all the documents encoded in the button without any additional interaction. The button syntax uses a parameter called “doclist”, which is followed by one or more template IDs to be auto-generated. Here is an example of the button syntax: (replace the highlighted values with your own template Ids):
    /apex/SDOC__SDCreate1?id={!CustomObj__c.Id}&Object=CustomObj__c&doclist=a02G0000005CiDO,a02G0000005CeCS
  10. Click "Save"

Step 3b: Place button on your page layout

  1. Go to the page layout: Setup➤App Setup➤Create➤Objects
  2. Click on your object name from the Label column (do not click on the edit link)
  3. Scroll down to page layout related list section, and click edit the “Edit” link next to the page layout where you want to add the S-Docs button (you will repeat this for each page layout that you want the S-Docs button to appear)3b1
  4. From the salesforce page layout screen, click  "Buttons" located in the top left toolbar menu. Once clicked, the right panel will display available buttons, where you should see your new button. 3b4
  5. Click and begin dragging the S-Docs button you just created into the lower portion of the page (your custom objects Detail Page Layout). Once you drag the button over the Custom Buttons section, you will see a green checkbox (indicating ok to drop) and you can release the button.3b5
  6. Be sure to click “Save” to apply the changes to the page layout and repeat steps 3-6 for any other layouts where you would like to add the button.

If you have already created an S-Docs template for your custom object, you can now open one of your custom object records, click on the S-Docs button, and generate your document. Otherwise, you will need to create at least one S-Docs template to begin using it with your custom Object. The next section describes this step.

STEP 4: Create your Custom Object Template

  1. Go to the S-Docs template home page by clicking on “All Tabs”, and then selecting “Templates” step-4.1
  2. Click the new button, from the S-Doc template object home page step-4.2
  3. Create your Custom Object template record. Be sure to select your Custom Object name from the “related to type” picklist values. Before you can first use this template, you should confirm you have also checked “Available for Use” and “Initially Visible” checkboxes. step-4.3
  4. Click Save, then click on “Template Editor” button. step-4.4
  5. Once in the editor mode, you can design your quote template using the WYSIWYG editor. The editor allows you to add text, format styles, insert tables, insert images and merge salesforce data by using the “Insert Field” and “Insert Related List” buttons. step-4.5
  6. You can also use leverage existing HTML templates by clicking on the “Source” button and then pasting your HTML. More information regarding template design and sample templates are available herestep-4.6
  7. Once your template is saved, you can test it by opening a sample custom object record, clicking on the S-Docs button, selecting your new template, and then click on generate. step-4.7
  8. Click on the document link or icon to open the document. step-4.8
  9. Document will open on the desktop.step-4.9