Winter '20 Release Note: If you are using S-Docs below version 4.53, you may experience an "Attempt to de-reference a null object" error when interacting with various forms of automation in S-Docs. In order to fix this bug, you can create a new SDocs Settings custom settings set. To do this, type "Custom Settings" into the Quick Find / Search bar in the Setup menu, and click Custom Settings. Click SDocsSettings, then click Manage at the top of the page. From there, click New. Fill out the following information:
SD Jobs Batch Size: 30
SD Jobs Move to Top of Flex Queue: ☑
Additionally, ensure that you have a Remote Site Setting for either login.salesforce.com (production), or test.salesforce.com (sandbox).
S-Docs is a powerful tool that allows you to generate and email documents natively on the Salesforce platform. By default, the user experience is very flexible. However, this flexibility means that the user makes all decisions during the document generation and distribution process, which takes time. As an administrator, you may want to automate the process to gain efficiency (to reduce time and clicks), reduce errors (by pre-selecting correct templates based on data) and to ensure compliance (to enforce business rules). S-Docs provides a one-click and zero-click feature described in this document to ensure you can tailor the user experience to meet your business requirements.
The document automation process can be considered a spectrum from maximum flexibility to maximum automation. The out-of-box behavior of S-Docs provides maximum user flexibility. In this use case, the user chooses the document(s), along with the default email template. They decide whether to include additional attachments, determine email recipients, and then finally decide if they want to print or email the generated document(s).
With S-Docs, you can achieve complete automation – meaning an event or field change could drive a fully automated document generation and distribution process, even when the user is not logged into Salesforce! For example, an account status changed to “closed” could generate a win-back email and special offer without any user involvement. Or, a case status change to “Ready for Proposal” could generate a proposal and send it to the client. You can see that there is a huge opportunity to improve your business process. As an administrator, you determine what level of automation is appropriate for your organization to meet your requirements. This document explains how S-Docs can be used to achieve those results.
S-DOCS AUTOMATION SPECTRUM:
|Maximum Flexibility [Most clicks] Maximum Automation [Least clicks]|
|OPTION 1||OPTION 2||OPTION 3||OPTION 4||OPTION 5||OPTION 6|
|Default S-Docs Behavior||Pre-select||“One Click”||One-Click + Email Prep||One-Click + Email Send||“Zero-Click”|
|User chooses every aspect of doc generation, attachments, and email options. You can add filter rules to help selection process.||Saves one step to filtering by selecting the default document(s) based on data such as language or product type. User can override pre-selected docs as needed.||Documents along with email cover letter are generated with a single click. User can then choose to print, return to record or proceed to email.||One-click leads to fully populated email page with all attachments, default email message and recipients completed. User can verify email and make edits as needed before sending.||One-click, document(s) are generated and emailed. Screen returns to the record detail page without any further user input. User cannot change document or messaging.||A Field change, or workflow sets off a trigger that generates and optionally emails the document(s). This is fully automated and ideal for mobile devices.|
The following options provide you with edits to the S-Docs button that you can use to increase automation. To get to the button edit page, navigate to the Setup menu and click Object Manager. Click the name of your object.
Then, navigate to the Buttons, Links, and Actions tab. Find the S-Docs button, click the arrow on the right, and click Edit.
S-Docs default behavior allows a user to choose any document(s) to generate along with any email template. The user can then decide to print or email the document. If emailed, the user can attach additional files, add recipients and customize the email message before it is sent. While this provides for maximum flexibility, it also requires the greatest amount of user interaction (clicks).
You can reduce template searching by optionally providing an initial search filter to the template list. When the user clicks on the S-Docs button, a subset of templates can be displayed to help them find the most likely one needed. This is done by using a search filter and/or category filter, as in the button URL. But keep in mind, the Salesforce user will still need to click the checkbox next to the template and then click the “Next" button to continue. If you want the box checked for them, you need to move to Option 2. Option 1 is useful when you have many templates and want to simply help the user by providing the likely choice. Users can still search for and use other templates as needed.
The first example below shows the button syntax where the templates are initially filtered based on a dynamic field value such as the language preference of the client. Using the “searchfilter” parameter below will automatically display only templates that have a “Name” or “Description” field that contains the value of the searchfilter parameter.
Button or Link URL:
Similarly, you can filter based on the value of the template’s “category” field. In this example, only templates with a category of “Contract” will be displayed by default. Button or Link URL:
This option will save user an additional click by automatically pre-selecting (filtering and checking off) the document to be generated. The user can still remove the pre-selected template and choose their own if they wish to override the default selection. The user will then need to click on the Next Step button to generate the document. This option is useful when you have business rules that can identify the correct template in the majority of use cases, but still allows the user to override the default selection if needed.
This automation is achieved by passing the template’s Salesforce ID or name into a URL parameter called “doclist.” This parameter can contain multiple template IDs/names, but they must be separated by a comma (“,”). Additionally, the oneclick parameter needs to be set to false. This tells the S-Docs engine to stop for further input.
S-Docs Button or link URL:
The doclist parameter can also be dynamically set using Salesforce functions within the button like “IF” or “CASE.” This button will choose the correct document and email template based on a field value. S-Docs Button or link URL:
Note: Template IDs are Salesforce-generated ID values associated to every record in Salesforce. To retrieve the Salesforce ID, you will need to open the Salesforce template record, and then copy/paste the ID value found in the browser's address bar. The ID is the last 18 character code of that URL.
The “one-click” builds on Option 2 but takes it one step further – the document(s) are generated without the user selecting any templates. Once the user clicks the S-Docs button, they will go directly to the list of newly generated documents. From there, they can then decide to view, print, email or return to the original Salesforce record. This option achieves one-click generation while still allowing the user to determine next steps.
One-click configuration is a similar URL to option 2, but should NOT contain the “oneclick=false” parameter. Only the doclist parameter (which contains a comma delimited list of documents) is needed.
S-Docs Button or link URL:
The “one-click” builds on Option 3 but again goes one step further – by pushing the user and documents to an email screen. To effectively use this option, one of the templates in the doclist should be of type “HTML.” This HTML template will comprise the default email body and can set the default subject line and recipients for the outbound email being prepared. Any other S-Docs templates that are included in the doclist will be automatically added as attachments. This option is appropriate where you want to give the user the opportunity to “eyeball” the email and make any small changes prior to sending. You can leverage the advanced features of the S-Docs Template to default all email values and lock down fields where you want to restrict the users. One-click is configured with a “prepemail=1” parameter in the S-Docs button URL. Only the doclist parameter (which contains a comma delimited list of documents) and prepemail parameters are needed. Again, when using this feature, one of the templates in the doclist should have an output type of “HTML” that will set the default email body. S-Docs Button or link URL:
This option will create the document and email it according to the parameters in the button and the configuration of the S-Docs templates included in the doclist parameter. This MUST contain an HTML template as one of the doclist parameters, and that template MUST contain at least a default “To” address, subject line and email body. Without this set, it will not be a valid email. The users will return to the original record detail page once complete. This is a useful option when you want complete control of the messaging but still allow the user to control when the message is generated.
S-Docs Button or link URL:
You can include additional email attachments to your outbound email by specifying the document ID or attachment ID parameters. Keep in mind that these records need to exist within Salesforce prior to the document generation process so their IDs can be included in the URL. Attachments use the parameter “aid=” followed by a comma delimited list of Salesforce IDs corresponding to attachment records. Salesforce documents use the parameter “did=” and the list of Salesforce IDs for the document record. S-Docs Button or link URL with additional attachments from attachment related list and documents tab:
This option can create documents and emails from the Salesforce platform whenever a field is set to a particular value. You can therefore use workflow rules to update a field value, which in turn can generate and optionally email documents through S-Docs. This option is ideal for behind-the-scenes document generation and distribution. It is also ideal for mobile devices, since it is a field change that runs a process without further user interaction. For example, you can easily add a custom picklist field on a mobile page layout. The user simply changes the value and saves the record. All document processing is handled post-save on the Salesforce platform. You can also do this without even prompting the user through workflow rules!
This integration uses the S-Docs Jobs Object in conjunction with the Salesforce Process Builder, Visual Workflows, or APEX triggers. You can learn how to use S-Docs Jobs for zero-click automation by reading this documentation.
You can alternatively use REST API for zero-click automation, although we recommend sticking with S-Docs jobs, as they can do anything that REST API can.