Category

Documentation

S-Sign Quick Install & Config Guide – Salesforce Lightning

By Documentation, S-Sign No Comments

Introduction

Welcome to S-Sign, a 100% native e-signature solution for Salesforce. This guide details the steps you need to take to install and configure S-Sign in your org so that you can get started with secure e-signatures. S-Sign leverages Salesforce Sites and the secure Connected App feature, which you'll learn how to set up in this guide.

To view this same guide for Salesforce Classic, click here.

Note: This article makes several references to your S-Sign Internal User. Your S-Sign Internal User is any licensed Salesforce user of your choosing. S-Sign operations that require internal data access will be conducted through this user's profile using the secure S-Docs Connected App. We recommend choosing a Salesforce Administrator.

Tutorial Video

Watch the following tutorial video or follow the instructions below to install and configure S-Sign in your org.

Install S-Sign

Unlike S-Docs, S-Sign is not available on the AppExchange. Contact S-Docs Sales to obtain an installation link for the latest version of S-Sign. Make sure to select "Install for All Users." We recommend testing in a sandbox environment before installing in your production org.

You may need to update S-Docs if you're running an older version.

Pro Tip

Try to keep as few tabs open as possible during this configuration process. This will help prevent settings confirmed in one tab from being negated by another open tab.

Head over to Installed Packages by typing "installed" into the Quick Find / Search bar in Setup to ensure that S-Sign has downloaded correctly and that your version numbers are up to date.

We recommend assigning the S-Sign User or Administrator permission sets to yourself and users who will be interacting with S-Sign. Learn more about S-Sign permission sets here.

Note: If you are using S-Sign version 2.1 or above, your org needs to have the Quote object enabled for S-Sign to work properly. To view instructions on how to enable Quotes for your org, click here.

Configuring S-Sign

Config Step 1: Create Remote Site Settings

S-Sign uses SendGrid, an email service, to send out verification emails to signers in order to confirm the signer's identity. This bypasses any email limitations you may run into in your Salesforce org, ensuring that your e-signature requests will always send. To allow S-Sign to tell SendGrid when to send out a verification email, you must create a Remote Site Setting within Salesforce that whitelists SendGrid's API domain (i.e. allows S-Sign to communicate with SendGrid).

To do this, simply click the Setup cog in the upper right hand corner, type "Remote" in the Quick Find / Search bar, and click Remote Site Settings from the options that drop down. Then, click New Remote Site.

Fill in the following fields for your new remote site:

Remote Site Name: SSign_Email_Verification_Site
URL: https://api.sendgrid.com

Ensure that the Active checkbox is checked. You can leave everything else as it is.

Next, create a new remote site for the Salesforce login URL if you don't have one already set up.

For Production Org:
Remote Site Name: Salesforce_Production

Remote Site URL: https://login.salesforce.com

For Sandbox Org:
Remote Site Name: Salesforce_Sandbox

Remote Site URL: https://test.salesforce.com

Finally, create a third remote site for your Salesforce domain.

Remote Site Name: Enter anything you'd like
Remote Site URL: Enter your Salesforce domain.

Note: You can copy your domain by clicking your user profile in the upper right corner, and copying it from under your username. Note that you need to add "https://" at the beginning.

If you are using S-Sign with communities, you should create a remote site for your custom domain as well.

Config Step 2: Create a Site to Capture External Users' Signatures

Like S-Docs, S-Sign is native to the Salesforce platform. This means that all signers must sign within Salesforce, even if they do not have a Salesforce account. To accomplish this, we'll set up a Site in our org that will display your document(s) and allow users to sign them.

Start by again clicking the Setup cog, then type Sites into the Quick Find search bar and [1] click Sites from the options that drop down. [2] Register a Force.com Domain from this page if you don't have one already. Then, [3] click the New button on the "Sites" list to create a new Site.

Fill in the following fields for your Site:

  • Site Label: S-Sign Site
  • Site Name: S_Sign_Site
  • Site Contact: This is the user responsible for receiving site-related communications from the site visitors and Salesforce.com. By default, it is set to the user creating the Site.
  • Default Web Address: You can append something to the end of your domain, but it is not necessary.
  • Active: Make sure this is checked so that the site is active.
  • Active Site Homepage: You can choose anything you want for this, but we recommend setting it to "Under Construction." This won't be visible to anyone.

Finally, ensure that you uncheck the Lightning Features for Guest Users checkbox. This is to conform to S-Sign's security standards.

You can choose whatever you'd like for the rest of the fields or leave them at the default settings.

Click Save.

Once you click Save, you should be redirected to the Site Detail Page. The only thing left to do for this step is to add a few Visualforce pages to our site. Scroll down to the "Site Visualforce Pages" list on the Site Detail Page and click Edit.

Add the pages SDOC.SDTemplateHTML, SSign.SSMultiSign, SSign.SSCreateSig, SSign.SSTemplatePDF, SSign.SSVerify, and SSign.SSViewEnvIncl. Then, click Save. You've now completed this step!

Create Sharing Rules

Note: If you are using S-Sign version 2.178+, please skip this step and move on to Step 3.

If you are using S-Sign version 2.110-2.177, you need to create a Sharing Rule on the S-Sign Envelope and SDoc Template objects. First, navigate to Setup > Sharing Settings, and choose your object. You will need to repeat this step for both objects.

Click New to create a new sharing rule.

Enter the following settings:

Rule Type: Guest user access, based on criteria
Field: Core Version
Operator: not equal to
Value: 1.00
Share With: S-Sign Site Guest User
Access Level: Read Only

Config Step 3: Create a Lookup Field to your Object on the S-Sign Envelope Object

You need to create a lookup field for any objects you’ll be using with S-Sign (Note: you can skip this step if your object is Opportunity or Contact, as a lookup field for these objects comes built into the package - if you are using version 2.1 and above, Contract, Quote, and Account will also have a lookup field pre-configured).

Navigate to the Object Manager in the Setup menu and click the S-Sign Envelope object (not S-Sign Envelope Documents).

Click the Fields & Relationships tab and click New.

Step 1 of 6: Choose Lookup Relationship for the field type. Click Next.

Step 2 of 6: Select the object for which you are creating the lookup relationship (the object you want to use S-Sign with). Click Next.

Step 3 of 6: This step is where you’ll add the field label and name. Default values can be kept for the rest of the fields.

  • For custom objects, the field label will just be the name of your custom object. The field name should be the API name of your custom object with only a single underscore and a 'c' at the end, instead of the usual "__c." For example: if your custom object was named CustomObject and the API name was CustomObject__c, then your field label would just be CustomObject, and your field name would be CustomObject_c.
  • If your custom object is part of a managed package, it will have a namespace at the beginning. Say the object's API name is NSP__CustomObject__c. For the field name, you would replace the two underscores after the namespace with _u_ and remove one of the underscores from __c, so the resulting API name would be NSP_u_CustomObject_c.
  • For standard objects, just enter the name of your standard object (ex. the Quote object would have the field name and field label 'Quote').

Step 4 of 6: Select your own field-level security settings. Click Next.

Step 5 of 6: Keep the default values.

Step 6 of 6: Add the S-Sign Envelopes related list to the appropriate page layouts. Click Save, and when you go to your object’s page, you’ll see the S-Sign Envelopes related list.

Config Step 4: Create an S-Docs Connected App

S-Sign leverages Salesforce's secure Connected App integration. This involves configuring a Salesforce Connected App and specifying an internal user in your org to conduct S-Sign operations through. To set this up, please follow the steps outlined in this article.

Assign The S-Sign Internal User Permission Set

After specifying an S-Sign Internal User during the Connected App configuration in Step 4, you need to assign the S-Sign Internal User Permission Set to said user.

From the Setup menu, type "Permission" into the Quick Find bar, click Permission Sets in the dropdown menu, then click on the S-Sign Site Internal User permission set.

Next, click Manage Assignments.

Then, click Add Assignments.

From there, choose the username that you specified as the S-Sign Internal User in Step 4.

Config Step 5: Provide Site Info

The next step is providing S-Sign with your Site's Site label and URL.

Start by navigating to the S-Sign Configuration page. If you are using S-Docs 4.381+, you can get to this page by clicking the App Launcher in the upper left corner, typing "S-Docs Setup" into the QuickFind bar, then clicking S-Docs Setup in the dropdown menu. From there, find and click on Go To S-Sign Setup Page.

If you are using a version of S-Docs below 4.381, the S-Sign Configuration page can be accessed through one of the following links:

[Production]: https://login.salesforce.com/apex/SSIGN__SSConfig
[Sandbox]: https://test.salesforce.com/apex/SSIGN__SSConfig

  1. The S-Sign Configuration page contains a field for your S-Sign Site URL. Ensure that the URL shown in this field matches the Site URL you created in step 2. To do so, navigate to the Site detail page for your S-Sign site (Setup > Sites > S-Sign Site), copy the site domain from the Custom URLs list, and paste it into the S-Sign Site URL field on the S-Sign Configuration page. Make sure to add https:// at the beginning of the domain.
  2. If your Site detail Custom URLs list includes two S-Sign Site URLs (shown below), use the URL that ends with secure.force.com.

Then, click the Set Site Info & Assign Permissions button. You can also click the Assign License button to assign an S-Docs license to the S-Sign Internal User if one has not already been assigned.

Config Step 6: Enter your License Key and Assign Licenses to Users

Once you've completed steps 1-5, you are ready to enter you license key and assign licenses to users in your org. Click Go To S-Sign License Page at the top of the S-Sign Configuration page.

From there, you can enter your license key.

If you are on the trial version, all you need to do is enter the license key, and then all users in your org will be able to use S-Sign. If you are on the paid version, you can now scroll down to assign licenses to individual users by selecting their names and clicking Add Selected Users.

That's it! S-Sign is configured for your org. You are now ready to create S-Sign-enabled S-Docs templates to send for E-Signature.

Use Global Functions To Add Or Remove Licenses

Orgs that need to add or remove a large number of S-Sign licenses can use the addSSignUserLicenses and removeSSignUserLicenses functions. These functions are global and can be called from anywhere, allowing for flexibility if you need to make a bulk update to your S-Sign license assignments. These functions take a List<String> object. Although there are many ways to use them, the following example demonstrates how to add an S-Sign license to all active users:

[code lang="html"]List<String> userIds = new List<String>();
List<User> activeUsers = [SELECT Id FROM User WHERE isActive = true];
for (User activeUser : activeUsers) {
userIds.add(String.valueOf(activeUser.Id));
}
SSIGN.SSLicensesController.addSSignUserLicenses(userIds);[/code]

Formatting Currencies

By Additional Formulas, Documentation, S-Docs Cookbook No Comments

Introduction

This article will teach you how to override the default currency format in your template and choose your own.

Let's say you would like to display “$235,000.00” as the Opportunity amount in your document rather than “235000,” which is the default formatting for the currency field. You can do this in one of two ways. The first option is to use S-Docs formatting, and the second is to use a Salesforce formula field.

Format Currency With S-Docs Syntax

To format currency using S-Docs syntax, you can simply add the correct formatting directly within your merge fields (add a space after the merge field name, followed by the currency format you would like):

[code lang="html"]${{!Contract.Total_Amount__c #,###}}[/code]

You can add this formatting yourself, or use the Insert Field button within the template editor to do so; currency options will appear for currency fields.

If the number/currency field is located in a related list column, you would need to edit the template source. Click the Source button and then locate the number/currency field within your template. You then need to replace the syntax to match the following:

[code lang="html"]<column format-number="#,###">quantity</column>
<column format-number="#,###.##" prefix="$">unitprice</column>
<column format-number="#.###,##" postfix="€">euro_price__c</column>[/code]

The example above shows the three supported formatting options. For others, you can use a formula field described below.

Format Currency With Salesforce Formula Fields

By adding the following formula field to your object, you leverage built-in Salesforce functionality. You would need to substitute your field name into the formula below (in place of “Amount”), and then drop the formula field into your S-Docs template. You do not need to add any of these fields to any page layout. You can add the dollar sign ($) to either the start of the formula or within the template design document proceeding your field.

[code lang="html"]IF(
Amount >= 1000000,
TEXT(FLOOR(Amount / 1000000)) & ",",
"") &
IF(
Amount >= 1000,
RIGHT(TEXT(FLOOR(Amount / 1000)), 3) & ",",
"") &
RIGHT(TEXT(FLOOR(Amount)), 3) & "." &
IF(<
MOD(Amount , 1) * 100 < 10,
"0" & TEXT(ROUND(MOD(Amount , 1), 2) * 100),
TEXT(MIN(ROUND(MOD(Amount , 1), 2) * 100, 99))
)[/code]

Note: This solution formats only the given value; it does not consider currency exchange rates. In such cases, you could use a combination of formulas: one to convert the currency based on the exchange rate, and another to format it correctly for your document.

Formatting Dates

By Additional Formulas, Documentation, S-Docs Cookbook No Comments

If you want to create a dated letter with the text “September 1, 2020” rather than the Salesforce formatted date-time, you can do so using S-Docs formatting syntax or using a Salesforce formula field. We recommend the first option where possible because it doesn’t require any Salesforce configuration changes.

Formatting Dates With S-Docs Syntax

Formatting dates with S-Docs syntax is easy; any Salesforce date and datetime field can be configured into any valid java pattern. Simply add a space in your date or datetime merge field, followed by the format you want:

[code lang="html"]{{!Quote.createdDate MM/dd/yyyy}}[/code]

You can also include time and timezone. For example:

[code lang="html"]{{!Quote.datetime__c MM/dd/yyyy hh:mm:ss TZ:America/New_York}}[/code]

Note: Make sure to use java time codes when using timezones.

If the date field is located in a related list column, use the following (you would need to edit the template source). Click the Source button and then locate the date column within your template.

[code lang="html"]<column format-date="MM/dd/yyyy">createddate</column>[/code]

The format-date syntax can accept a wide range of values. You can add minutes, timezones, etc. Pay attention to caps, as mm is minutes, whereas MM is month.

Use this reference to view all date formatting options:  https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

Formatting Dates With Salesforce Formula Fields

If S-Docs syntax options do not meet your requirements, you can format dates by leveraging Salesforce formula fields. By adding the following formula field to your object, you can leverage Salesforce functionality. You would need to substitute your field name. You do not need to add these fields to any page layout. If you are working with a Date Field (not a DateTime field), see the next example for slight modifications needed.

[code lang="html"]CASE( MONTH( DATEVALUE(LastModifiedDate) ), 1, "January", 2, "February", 3, "March", 4, "April", 5, "May", 6, "June", 7, "July", 8,
"August", 9, "September", 10, "October", 11, "November", 12, "December", "-" )
+ ' ' + TEXT(DAY( DATEVALUE(LastModifiedDate))) + ', ' + TEXT(YEAR( DATEVALUE(LastModifiedDate)))[/code]


Displaying checkboxes

By Documentation, S-Docs Cookbook, Using Images No Comments

If you want to create a document that contains checkbox images rather than “True” or “False” values, you can do so in two different ways.

Display Checkboxes With The Checkbox Merge Field Attribute

The easiest way is to add the checkbox merge field attribute to any boolean field that you want to display as a checked or unchecked checkbox.

Example Merge Field:

[code lang="html"]{{!Opportunity.Checkbox__c}}[/code]

Standard Checkboxes:

Display a standard checkbox (dotted white border with black check) that is checked if the boolean field is true, and unchecked if it is false:

[code lang="html"]{{!Opportunity.Checkbox__c checkbox="true"}}[/code]

Display a standard checkbox (dotted white border with black check) that is unchecked if the boolean field is true, and checked if it is false:

[code lang="html"]{{!Opportunity.Checkbox__c reverse_checkbox="true"}}[/code]

Black Checkboxes:

Display a black checkbox (solid black border that fills in black with a white checkbox) that is checked if the boolean field is true, and unchecked if it is false:

[code lang="html"]{{!Opportunity.Checkbox__c checkbox="black"}}[/code]

Display a black checkbox (solid black border that fills in black with a white checkbox) that is unchecked if the boolean field is true, and checked if it is false:

[code lang="html"]{{!Opportunity.Checkbox__c reverse_checkbox="black"}}[/code]

Radio Buttons

Display a radio button that is checked if the boolean field is true, and unchecked if it is false:

[code lang="html"]{{!Opportunity.Checkbox__c checkbox="radio"}}[/code]

Display a radio button that is unchecked if the boolean field is true, and checked if it is false:

[code lang="html"]{{!Opportunity.Checkbox__c reverse_checkbox="radio"}}[/code]

Learn more about merge field attributes here.

Display Checkboxes With CSS

Checkboxes can also be displayed using CSS styling similar to the following example:

[code lang="html"]<style type="text/css">.checkbox {
border: 1px solid black;
padding-left: 2px;
padding-bottom: 2px;
height: 9px;
width: 9px;
}
</style>
CHECKBOX
<div class="checkbox"> </div>[/code]

Display Checkboxes With Formula Fields

You can also display checkboxes by leveraging a formula field.

By adding the following formula field to your object, you can easily leverage it to place checkbox images into your S-Docs. (You do not need to add the field to the page layout.)

Note: Your formula field should have a Formula Return Type of Text and should be referenced as rich-text when merging into a template. The field used in the example, IsAccount__c, should be a checkbox field on your object that is checked by default.

[code lang="html"]IMAGE(
IF(IsAccount__c, '/img/checkbox_checked.gif', '/img/checkbox_unchecked.gif'),
'CheckBox'
)[/code]

Embedding Google Charts into your document

By Documentation, S-Docs Cookbook, Using Images No Comments

Introduction

Leveraging Google Charts API provides a great way to include dynamic charts in your S-Docs.
You can find more information on Google charts here: http://code.google.com/apis/chart/

Create A Remote Site Setting:

This functionality requires an entry in Salesforce's Remote Site Settings.

  1. Click Your Name > Setup > Security Controls > Remote Site Settings.
  2. Click New Remote Site button.
  3. Set the Remote Site Name field to SDOCS3.
  4. Set the Remote Site URL field to http://chart.apis.google.com
  5. Make sure Active is checked and then click the Save button.

Google Chart Examples

Here are a few examples of Google charts:

Google-charts

The charts work by passing the Salesforce data to the Google API, which in turn dynamically builds and returns the chart as a PNG image.

Security Note: Unlike S-Docs, which works entirely within the Salesforce.com platform, Google charts are hosted remotely. Depending on the chart, your data is passed from Salesforce to Google. Your security team would need to determine if this is an acceptable practice.

Images are rendered by using one URL request per chart. For example, you can manipulate the values in the following URL to render a different pie chart:
[code lang="html"]http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Jan|Feb[/code]
The link above will return the following image:

example-chart

As you may begin to see, using Google Charts API is all about creating these URLs where you pass in the data points, legends and chart options. Depending on the chart, some of these URLs can be long and a bit complex.

Option 1: Use Formula Fields For Your Google Charts

Rather than building complex logic within S-Docs to create these URLs, we again leverage Salesforce formula fields to do the heavy lifting.

Here is a great tutorial from Salesforce on how to create Google Charts using a formula field:

http://wiki.developerforce.com/index.php/Using_Formulas_and_Google_Charts_to_Visualize_Data

The above tutorial will walk through how to build the following formula field to display a Won/Loss pie chart:

[code lang="html"]IMAGE("http://chart.apis.google.com/chart?cht=p3&chd=t:" & Text(Won__c/(Won__c + Lost__c)) & "," &
Text(Lost__c/(Won__c + Lost__c)) & "&chs=275x100&chf=bg,s,F3F3EC&chl=Won|Lost&chco=5555ff", "chart text")[/code]
Then, we simply drop this formula field into our S-Doc template (be sure to check Contains Rich Text box).

Option 2: Use The Google Chart API URL In Your S-Docs Template

While more complex, another approach is to build the Google Chart API URL in your S-Doc Template and then mix in field values. This may offer you greater control. Using syntax similar to the following, you could add the image, where ChartLegend__c would just contain the value “Jan|Feb.”
[code lang="html"]lt#img src= quot#http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=
{{!MyObject__c.ChartLegend__c}}quot# /gt#[/code]

Improving performance on pages with many Google charts:

The Google documentation offers a good performance tip if you plan to embed 5 or more charts. By appending a 1-9 before the “chart.apis.google.com,” you can have the browser load the charts simultaneously. For example:

  • http://0.chart.apis.google.com/chart?cht=...
  • http://1.chart.apis.google.com/chart?cht=...
  • http://2.chart.apis.google.com/chart?cht=...
Note: S-Docs does not support the Google Visualization API.

Adding Dynamic Images into Templates

By Documentation, S-Docs Cookbook, Using Images No Comments

Introduction

While you can insert static images into your templates, S-Docs can also insert dynamic images. For example, say you want to create a letter that includes an image of the representative’s signature at the bottom of a page. Or similarly, you may want to include an image of your product on a Product Specifications PDF. Rather than cloning the same template many times (once for each unique image), you would rather have just one template that dynamically includes the right image. You can accomplish this in several ways.

Option 1: Use a rich text field

This is perhaps the easiest method. You first upload your image into a standard Salesforce rich text field on your record detail page. Then, open the template in which you want to add the image, click on the Template Editor button, click on the Insert Field button, select the rich text field, click on the Contains Rich Text checkbox, and finally click on the Insert button. Your documents will now render the rich text content for that record wherever you placed this field.

Note: This option is only available for PDF documents. If your rich text contains many items or elements, it may not render precisely. This is because Salesforce uses a rich-text editor that auto-formats rich text content and this formatting cannot be overridden through a source editor. It is a better practice to use the S-Docs editor to control document layout rather than inserting a complex rich-text field into a template. By doing so, you also maintain template formatting in a central location (the S-Docs template) versus fragmented design elements located in rich text fields throughout individual records.

Option 2: Use a standard text field that contains the entire image markup

You can also use a standard Salesforce text field whose value contains the complete image element tag that you want to include. Each record would potentially contain a different link that corresponds to the applicable image.

For example, set the value of a ProductImage__c field on a Product record to:
[code lang="html"]PRODUCT IMAGE:<br><img scr=”/host/Product123Image.png” />[/code]
Then, using the S-Docs template editor, click on the Insert Field button, select the field, and then be sure to click on the Contains Rich Text checkbox.

This is a simple approach but has limited usage. It is useful for images such as representative signatures, where they are centrally controlled by an administrator, they do not change frequently, and the user would not normally need to view them in the Salesforce user interface along with the record. Since this is a text field, if you were to include this field on a page layout, it would not render as an image – users would only see the text shown above when viewing the record detail in the Salesforce UI. Therefore, it would not be appropriate for end-users who upload their own images frequently (e.g. a scanned photograph of a damage claim) or wanted to view the actual image in Salesforce within the record detail page.

Option 3: Use a formula field to display an image

Building on option 2, you can leverage a Salesforce formula field to create the image path and also display the image within the Salesforce record detail. You would then drop the formula field into your S-Docs template with the Contains Rich Text option checked (as described in the previous option). The formula field would contain something similar to the following:
[code lang="html"]IMAGE("/CompanyIntranet/Products”+ myObject__c.ProductID__c + “.png")[/code]
This option requires some planning so that the image field name can be programmatically derived.

Option 4: Build an image URL within the S-Docs template

This is a combination of options 2 and 3, but would not require a formula field. You can use a record’s existing field value to help build the correct image path, but you create the full path value within the S-Docs template, not in the Salesforce field.

For example, to include a dynamic product image or agent's signature, you can use something similar to the following in your document template source:
[code lang="html"]lt#img src=quot#http://intranet/{{!Product2.ProductPath__c}}.png quot# /gt#
lt#img src=quot#{{!Opportunity.Owner.SignatureURL__c}}quot# /gt#[/code]
The field value should be a URL that points to either an image in your Salesforce documents folder or an external image hosted on the public internet. In the second example, the field should contain the entire path including the ‘http://’ prefix.

Since the image path is text (not markup) it should only be surrounded by double curly braces, as shown above. The special notation for  <, >, and quotes, using lt#, gt#, quot# respectively, is used to instruct S-Docs that this markup needs to be evaluated rather than rendered literally. Having this flexibility gives you total control of how you want a field interpreted within the S-Docs template.

In order to compensate for relative URLs (e.g src=“/servlets/…”) that Salesforce automatically generates, S-Docs will automatically replace the relative path with the complete path, including the correct Salesforce.com instance (e.g. src=”https://na1.salesforce.com/servlets/...”). Doing this ensures your embedded images render correctly when viewed by others. If you wish to override this behavior and use a relative URL, you should specify the path to include the “http” (e.g. src=”http://servlet/”).

Discussion

Once you have inserted a marked-up field into your template, you will notice three sets of braces that surround your field, for example:
[code lang="html"]{{{!Product2.ProductImage__c}}}[/code]
The extra pair of curly braces instructs S-Docs to interpret this field rather than just displaying the stored value. Without this, S-Docs would not know whether a field containing the value “<img src=“//host/Product123Image.png” />”  should be displayed as the text quoted or substituted with the actual image when rendered. Whenever you add a field using the template editor and click on the Contains Rich Text checkbox, S-Docs will evaluate the value regardless of the actual Salesforce field type (Rich Text or otherwise).

If images outside of Salesforce are used in the S-Docs template directly, or dynamically through a merged image field, you must whitelist the URL domain (using Setup > Remote Site Settings) to avoid broken image icons in the PDF.

Embedding static images into your document

By Documentation, S-Docs Cookbook, Using Images No Comments

Embed Static Images Using Code

To embed static images, like a company logo, in your documents, you can use an image tag similar to the following in your S-Docs template source.

[code lang="html"]<image src="http://publicsite/imagename.png" />[/code]

This may be the simplest approach if you are emailing HTML content or wish to embed an image pixel for email tracking. However, keep in mind that if this image is not stored in your Salesforce org or if the host server is not under your control, the linked image may change and therefore is not guaranteed to work.

Embed Background Images/Watermark

A background image or watermark can be added to your document by including the following CSS styling with your image URL.

[code lang="html"]<style type="text/css">body{ background-image: url("https://background.image.url"); background-attachment:fixed; background-position: center; background-repeat:no-repeat;background-size:400px; } </style>[/code]

Note: The background image/watermark will be the same for every page of the document. For different images on different pages, you can use the DOCX document format.

Embed Static Images That Are Stored As Salesforce Documents

You can also embed images that are stored as Salesforce documents.

[1] Use the Add Image button on the template editor toolbar to open a menu for adding images into S-Docs.
[2] Click Browse Server to search and add the desired image from your Salesforce documents folder.

If you intend to send a document externally that requires access to the image at view-time (e.g. an email template), be sure that the Salesforce document record, which contains the image, is set for public visibility and copy the image's full URL: 1. Check the Externally Available Image box to make the image visible on the public internet. 2. Right click the image itself and copy its full URL. In Google Chrome, you would right click the image and click Copy image address. In Firefox, you would right click the image and click Copy image location. In Internet Explorer, you would right click the image and click Properties, and then copy the URL from the "Address (URL)" field in the following pop-up window.

Embedding Static Images (2)

You can now add this image into your template by clicking the Add Image button icon in the template editor and pasting the URL you copied into the URL field of the "Image Properties" window.

Embed Static Resources As Images

You can also embed static resources as images within your S-Docs templates using the following code:

[code lang="html"]<img src="/resource/STATIC_RESOURCE_API_NAME/PATH_TO_IMAGE" />[/code]

For example, your static resource reference might look like this:

[code lang="html"]<img src="/resource/Pckg__Pckg_Images/FolderInTheResourceZipFile/the_image.png" />[/code]

Embed Static Images In DOC Templates

For DOC templates, in order to ensure that your images are scaled correctly in the final generated document, it is important to check Embed Images in the Page Settings tab of the template editor.

Additionally, the image source should be in this format (using the style attribute):

[code lang="html"]<img src="..." style="height: ...px; width: ...px;" />[/code]

Rather than this format:

[code lang="html"]<img src="..." height="..." width="..." />.[/code]

Note the difference in the height and width. If you use the second example, the images will show up as tiny squares in the generated document.
Finally, the user must click Enable Editing in Microsoft Word for images to download in the generated document.

Note: For images that you need to have externally available, note that the Browse Server button will use the local path rather than the full path, and your image will not be available externally (even if Externally Available Image is checked).
If you want this image to be visible externally (such as including it in an email sent to your customers), you must append the base URL to the beginning of the local path in the source code; e.g. if the Browse Server button uses this path: /servlet/servlet.ImageServer?id=01536000001T3ZE&id=00D36000000v29C&lastMod=147065920900), you must add https://na30.salesforce.com to the beginning to make the image externally available.

You can also forgo using the Browse Server button and use the full path from Classic view rather than the local path (e.g. use: https://na30.salesforce.com/servlet/servlet.ImageServer?id=01536000001T3ZE&oid=00D36000000v29C&lastMod=147065920900 rather than: /servlet/servlet.ImageServer?id=01536000001T3ZE&id=00D36000000v29C&lastMod=147065920900) when referencing the image in your S-Docs template. This is why we copied the image's full URL and pasted it into the "URL" field of the "Image Properties" window in the steps above.

Moving S-Docs Templates from Sandbox to Production

By Best Practices, Documentation, S-Docs Cookbook No Comments

Video Tutorial

Import Templates With The S-Docs Template Migrator

Moving S-Docs templates from your Salesforce sandbox org to your Salesforce production org is easy with the S-Docs Template Migrator. The Template Migrator will generate a .zip file of templates that can be imported into any org of your choosing. If your template contains attachments (such as DOCX templates), those will be included as well. If any of your templates are S-Sign enabled, the S-Sign data will also be preserved. Let's take a look at how this works.

Note: S-Docs 4.210 or higher is required to use the S-Docs template migrator. S-Sign version 2.78 or higher is required to migrate S-Sign templates.

If you are using S-Docs 4.381+, navigate to the S-Docs template migrator by clicking the App Launcher, typing "S-Docs," and clicking S-Docs Setup in the dropdown menu. Scroll down to the Migrate S-Docs & S-Sign Templates section and click Go To S-Docs Migration Page.

If you are using a version of S-Docs below 4.381, navigate to the template migrator by appending the following after "salesforce.com" in your browser:

[code lang="html"]/apex/SDOC__SDMigrate[/code]

You'll be presented with this screen.

This page has two sections: Import and Export. We'll look at Export first.

Export Templates

The template Export section appears as follows:

To generate a list of templates to export, begin by [1] setting filters for which templates should be included. Filters need to be written using SOQL syntax. The example above uses the following filter:

[code lang="html"]WHERE Document_Category__c='Contract'[/code]

This will generate a list of all templates with the Document Category field set to "Contract." [2] Click Set Export Filters to generate a list of all templates that meet the filter criteria.

 

Example Export Filters

The following table provides different SOQL filter syntax and what the template migrator will return. This list is not exhaustive and is only intended to provide samples of acceptable syntax.

Filter Output
WHERE Name LIKE '%Master Service Agreement%' All templates that contain 'Master Service Agreement' in the Template Name field.
WHERE Name='Quote' OR Name='Business Proposal' All templates with a Template Name of "Quote" or "Business Proposal.'
WHERE Base_Object__c='Opportunity' ORDER BY CreatedDate DESC LIMIT 5 The 5 most recently created templates with a Related To Type field set to "Opportunity."
WHERE Name IN ('Invoice','Standard Invoice','Invoice - By Product') All templates with a Template Name equal to exactly "Invoice," "Standard Invoice," or "Invoice - By Product."
Note: If you do not specify any filters, clicking Set Export Filters will generate a list of every S-Docs template in your org.
Note 2: To find a list of field API names for the SDoc Template Object, navigate to Setup > Object Manager > SDoc Template > Fields & Relationships. Note that most fields are preceded by the SDOC__ namespace prefix; be sure to omit this prefix when including fields in your filter.

After clicking Set Export Filters, every template that meets your filter criteria will be [1] added to the table at the bottom of the page. This table displays the Template Type, Template Name, and Template ID fields. If your S-Docs template is S-Sign enabled, a separate S-Sign template will be included with it; when you import these templates into a production org, they will be recombined into a single template. You can [2] use the checkboxes on the right to manually include or exclude certain templates from your export.

[3] Click Generate Export Zip to generate a .zip file that contains all of your templates. If you'd like to exclude data from individual template fields from being carried over, you can [4] check the Exclude SDOC Template Fields? box. This will open up a new menu.

Exclude SDOC Template Fields

The Exclude SDOC Template Fields menu appears as follows:

To exclude data from individual fields in your template export, [1] select the field on the left and [2] use the arrow keys to add it to the exclusion list on the right. If you select Template Name, for example, all of your templates will be imported into your production org without names.

If you want to preserve these settings (i.e. you want to exclude the same fields every time you export templates), you can [3] enter a file name and click Download Current Settings to download the settings as a .txt file. When you need to export templates again, you can [4] select Choose File and upload the .txt settings file.

Note: The Download Current Settings button will also save any filters that you used to generate your list of templates for export.

Import Templates

The template Import section appears as follows:

Click Choose File to select an exported .zip file of S-Docs templates.

When you upload your template file, [1] each template will be added to the template table at the bottom of the Import section. Just like in the Export section, you can view the Template Type, Template Name, and Template ID fields. [2] Click Start Import to import your templates. You can also [3] set certain field values for your templates before importing them by checking the Set SDOC Template Values? checkbox. This will open up a new menu.

Set SDOC Template Values

To begin, [1] click Add Field/Value. [2] A picklist of template fields will appear underneath, along with a text field where you can set the field data. In the example above, the Template Name field of each imported template will be changed to "Imported Template." Click Add Field/Value again to set additional fields.

Note: Set Boolean fields (such as Allow Edit) using True or False.

If you want to preserve these settings (i.e. you want to set the same field values every time you import templates), you can [3] enter a file name and click Download Current Settings to download the settings as a .txt file. When you need to import templates again, you can [4] select Choose File and upload the .txt settings file.

After your import is complete, a success message will appear under the Start Import button.

Template Migrator Considerations

  1. If you're migrating PDF-Upload templates that were created prior to S-Docs version 4.210, you'll need to convert any images that are present in them to Attachments. Previous versions of S-Docs stored these images as Documents, but the template migrator will only be able to export and import PDF-Upload templates that store images as Attachments. To convert older PDF-Upload templates, append the following URL after "Salesforce.com" in your browser:
    /apex/SDOC__SDMigrate?convertPDFPageImages=true
    This will add a Convert PDF Page Images button to the template migrator that will convert all PDF-Upload images to Attachments for you.
  2. The template migrator uses a field called Org_Agnostic_ID__c that doesn't change when it's migrated across orgs. This allows the template migrator to update a template that already exists in the production org when migrating the corresponding template from the sandbox org, rather than re-inserting the template and ending up with duplicates in the production org. If you've previously transferred templates using a utility other than this one (e.g. Data Loader), the templates you migrated will not have an Org-Agnostic ID in the production org, and hence won't be updated when you upload an export that includes the corresponding templates from another org; rather, the templates in the export will just be inserted and you'll end up with duplicates. In this case, you can delete all of the templates from the production org, then perform an import using this tool.

Import Templates Individually

If you created only a few (i.e. less than 15) S-Docs templates in your sandbox that you would like to move to your production org, you can import each template individually.

Import Templates Using Data Loader

You can also use the Salesforce Data Loader to import a large number of templates, although this method is not recommended -- the S-Docs template migrator is best practice for importing or exporting a large number of templates. If you want to use data loader, follow the steps below:

  1. Using DataLoader, export all SDoc Template records and fields from your sandbox org.
  2. Edit the resultant CSV and perform the following:
    1. Remove the row with NAME = "License Key"
    2. Remove all ID field columns (ID, CREATEDBYID, LASTMODIFIEDBYID, OWNERID, SDOC__Component_IDs__c, SDOC__Preview_Id__c, and SDOC__Master_Template__c)
    3. Remove all Date field columns (CREATEDBYDATE, LASTMODIFIEDDAE, LASTACTIVITYDATE, SYSTEMMODSTAMP, etc.)
    4. Remove all ENCODE field columns (SDOC__Template_XML_Encode__c, SDOC__Template_XML_Encode10__c, SDOC__Template_XML_Encode2__c, SDOC__Template_XML_Encode3__c, SDOC__Template_XML_Encode4__c, SDOC__Template_XML_Encode5__c, SDOC__Template_XML_Encode6__c, SDOC__Template_XML_Encode7__c, SDOC__Template_XML_Encode8__c, SDOC__Template_XML_Encode9__c, SDOC__Terms_XML_Encode__c)
    5. Remove all formula (SDOC__Format_Icon__c, SDOC__Restore_Link__c)
  3. Save as import CSV.
  4. Using DataLoader, insert the import CSV file from Step 3 into SDoc Template on your production org.
  5. Open Developer Console on your production org. Insert and execute the following in an Execute Anonymous window:
    [code lang="html"]update [SELECT Id FROM SDOC__SDTemplate__c WHERE Name != 'License Key' ORDER BY SDOC__Template_Format__c];[/code]

    Note: If you have more than 100 templates you may need to add LIMIT 100 OFFSET 0 to the SELECT statement and execute the update multiple times, incrementing the OFFSET value by 100 each time until all templates have been updated.

Discussion

If your templates make references to data (images, related lists, etc.) in your sandbox, these references still might work in your production instance. This is because templates in production are still able to use data from sandboxes. This is undesirable behavior; if you change/delete your sandbox, or change/delete certain data in your sandbox, then these references will no longer work.

We recommend pointing image references in your sandbox templates directly to image URLs in your production org. If you do this, you won't need to update any of your images once you move your sandbox templates into your production org.

We strongly recommend that you recreate all other types of sandbox data in your production org. After importing your templates into your production org from your sandbox, you can then proceed to update your templates to reference the data in your production org, rather than the data in your sandbox org.

Choosing between PDF, HTML, DOC, DOCX, or XLS formats

By Best Practices, Documentation, S-Docs Cookbook No Comments

Introduction

There are a multitude of different output types that S-Docs templates support. This document will go through five common ones and explain when to choose each one.

Some document formats are better suited for certain document types. For example, PDFs typically work best for contracts since you do not expect users or clients to edit them after generating (although S-Doc PDFs can be edited if the "Allow Edit" feature is enabled). As an administrator, you should select the right format based on how you expect the document to be viewed, used and distributed.

You must select one output format for each template. If you want to give your users control of the format, you can simply clone your template several times and save each version with a different output format. If all the versions are made active, the user could then choose the template with their desired output format.

PDF

PDF documents created with S-Docs are self-contained. By this, we mean that the complete content is stored within the document rather than using links that retrieve content when the document is opened. Therefore, internet connectivity is not needed to view any embedded images and using relative links do not pose a problem. Since the PDF is viewed using a Reader, the output is very consistent and predictable even across mobile clients. Although S-Docs allows you to choose whether or not your users can edit documents (including PDFs) after they have been generated, if you keep this option disabled, editing PDFs can be difficult, meaning it is a good choice when you do not want the user to edit the document after it has been generated. Therefore, this output is well suited for documents like quotes, contracts, or product information sheets.

However, rendering in PDF does have some design considerations. Specifically, not all fonts are supported, nor are all CSS styles. To get the desired result, you may need additional editing time or are afforded some leeway on the final output.

If you have existing company PDFs that you would like to use with S-Docs, you can leverage the PDF-Upload feature to upload your documents and drag and drop merge fields onto them. However, uploaded PDFs have certain limitations; namely, they do not support related lists.

To work around PDF-Upload limitations, you can convert your existing PDF to HTML so that it can be saved as an S-Docs template. Adobe provides free automatic conversion tools that can be found here: http://www.adobe.com/products/acrobat/access_onlinetools.html. You may need to edit the template after conversion in order to make it appear as the original.

DOC & DOCX

The DOC and DOCX formats are often the best choice for rendering form letters, especially when the message needs to be tailored for each document, such as customer service letters or meeting follow-ups. These formats are often used when there is a need to uniquely edit or personalize each document after it has been created.

Although both templates are output as Microsoft Word files, DOC templates are configured and edited within the S-Docs template editor, while DOCX templates are configured and edited within Microsoft Word and then uploaded to the S-Docs template editor.

DOC Templates

DOC templates are great if your document is very large or needs to include a lot of data-driven formatting. Since they're built and edited within the S-Docs template editor, there's a lot more flexibility when it comes to things like custom related list tables.

When you generate DOC templates, S-Docs uses the template definition you provide to create a new DOC file. You don’t need to configure a connector, plug-in, or any macros. This means you cannot use an existing DOC file (however, you can use the Paste From Word button to copy content from an existing DOC file into the template editor). After generating the document, the user can then leverage all the features of MS Word to further tailor the content of each message.

The following special S-Docs syntax can be used to insert a table of contents in your DOC template:

##TOCSTART## and ##TOCEND##

DOCX Templates

DOCX templates are built entirely within Microsoft Word and then uploaded to S-Docs. They're great for documents with a lot of non-data-driven formatting, since you can leverage the full feature functionality of Microsoft Word to easily insert tables, tables of contents, and other elements. The DOCX format is useful for users who are already proficient in Microsoft Word.

S-Docs elements like merge fields, related lists, and conditional logic can be included in your DOCX templates as well -- users simply need to copy syntax from the S-Docs template editor and paste it into their Microsoft Word document within square brackets.

Please refer to this documentation for important information regarding DOCX syntax and generation.

For templates with complex, data-driven formatting requirements, the DOC type should be used instead of DOCX, since more complex formatting is only supported within the S-Docs template editor.

XLS

For large related lists, you may want to render your document using the XLS file type. After a user creates the S-Doc, they can update the spreadsheet as usual.

Note: Similar to how S-Docs generates a DOC document, S-Docs does not populate an existing XLS file with data, but rather generates a new XLS file. This means that you do not need to create and share a template XLS file. All definitions and formulas should be defined in either Salesforce formula fields, or alternatively, using the S-Docs template editor. If you have existing XLS documents you want to use with S-Docs, you will need to save them as HTML and use the HTML output as the basis for your S-Docs template. You may need to remove some special formatting Microsoft automatically adds to the document that prevents non-Microsoft browsers from rendering the document correctly. There are also tools available online for converting Excel to HTML.

Tip

Since it is often difficult to predict a particular cell location that your S-Docs field will render to in MS Excel, and since many formulas require cell locations, it is often easier to create formulas using a two step process. First, you create your fields and render the document without any formulas. Then, once you have identified all your target cell locations, you can add your excel formulas using the S-Docs Template Editor.For example, typing the following text into the S-Docs template editor will sum the values of the contents of rows 4 through 8 in Column A.

=SUM(A4:A8)

You can also use a VLookup function to help locate values you want to update with Salesforce data. Here is a useful resource for creating Excel formulas: http://www.mrexcel.com/archive/Formulas/index.html

HTML

HTML is the most flexible of the output formats. HTML docs can even contain editable text areas. This is the format of choice if you wish to send an in-line document via email. However, you should note that images are retrieved when the document is viewed. For this reason, we do not consider the document "self-contained." This means users not only need to be connected to the internet to view your document appropriately, but also to have access to the embedded images. While embedded images can be useful for tracking, rendering consistent HTML on a variety of devices, browsers and email clients can also be challenging.

Note: If a user emails an HTML S-Doc during the last step of generation, S-Docs will automatically include the document in-line as HTML in the email body.

Using Images

If you are looking to embed images into your S-Doc, check out these guides on how to embed dynamic images or static images in your document.

Using S-Docs with Salesforce Chatter

By Best Practices, Documentation, S-Docs Cookbook No Comments

Introduction

Since S-Docs is a Native Force.com app, it integrates seamlessly with Salesforce Chatter.  Enabling Chatter on S-Docs will allow users to comment (Chatter) on specific S-Docs, and notify any user ‘following’ an S-Doc of changes. For general information on how to configure Chatter, please start with this Salesforce tutorial.

S-Docs uses a junction object (S-Docs Relationships) to relate generated S-Docs to your Salesforce records. When enabling S-Docs for Chatter, we recommend enabling the Chatter feed on the S-Docs Relationship object, not on the S-Doc object itself.

Enable Feed Tracking For The S-Doc Relationship Object

First, navigate to Build > Customize > Chatter > Chatter Settings and make sure the Chatter feature is enabled for your org. Next, navigate to Build > Customize > Chatter > Feed  Tracking. From here, select the “SDOC Relationship” object, as shown below:

Then, check Enable Feed Tracking to be able to select fields to track. Typically, customers will want to track just the “Status” and “Comment” fields, as these are the fields that are most meaningful to track. If you integrate S-Docs with an electronic signature solution like S-Sign, users could be notified via the Chatter feed that documents have been executed by the customer.

Create A Hyperlink On The S-Docs Related List

Now that you have Chatter enabled and Feed Tracking set, you will need to make one additional change. You will need to create a hyperlink on the S-Docs related list that can take the user to the S-Docs Relationship record detail page. This is the only page where users can click on the Follow button located on the Chatter toolbar.

Background: By default, there is no such hyperlink on the S-Docs related list, and this was done intentionally. While the S-Docs related list includes a column labeled “Document Number,” this field is a plain text field (not a hyperlink). If this field were a hyperlink, the user might expect this to open the S-Docs itself – not the S-Docs Relationship record. To eliminate any confusion, the hyperlink was intentionally removed.

However, for Chatter, we do need to get to the S-Docs Relationship record in order to allow users to click on the Chatter Follow button. Unfortunately, the first column in the related list (“Edit” link) won’t work either. While this link does take the user to the S-Docs Relationships page, it is rendered in edit mode, and the Chatter toolbar does not render for records in edit mode. So, you will need to add a new column to your S-Docs related list view that will take the user to the S-Docs Relationships record detail page.

While you might first consider using the Relationship ID field as an easier approach, this ID value would display the S-Doc Relationship ID, not the S-Doc ID, which again may confuse users. A formula field rendered as a hyperlink is the best solution. Since each org will have its own preference on how this related list column should appear, we have not included this formula field in the core S-Docs package, but rather leave it up to the Salesforce Admins to implement.

You will need to create this hyperlink using a custom formula field on the SDOC_Relationship__c object. You will then add this field to the related list view.

By using the formula below, you could include a new column that replaces “Document Number” with the same value but is a hyperlink to the S-Doc Relationship record. (For comparison only, both columns are included in the related list shown below.)

sdocs

Related List Columns

The table below describes the intended behavior we are seeking:

Column Click Action
Column 1 (Edit link) Open S-Docs Relationship record in edit mode. User can add/edit comments or change S-Doc status.
Column 3 (Excel icon) Opens the actual S-Doc in new window (e.g. launches MS Excel).
Column 5 (S-Doc Link) Opens S-Doc Relationship detail in same window. Users could then click on the “Follow” icon from the Chatter toolbar.

The example below uses an alternative link. The following formula will create a “Set Chatter Prefs” link field that you then add to the related list layout.
[code lang="html"]HYPERLINK('/'+ Id , “Set Chatter Prefs”, "_self" )[/code]
sdocs

Once you’ve added the link to the relationship object, the user simple opens the record and then clicks on the follow icon.

sdocs2

Top