All Posts By

S-Docs Team

Pull Image Attachments and Generate a PDF

By Documentation No Comments

You can easily insert image attachments/files that are related to a record into your PDF document. Paste the following code into the Source of the template editor where you want your pictures to appear. The LIKE test in the where clause might need to be adjusted.

Image Files

For image files, use:

[code lang="html"]<!--{{!
<lineitemsSOQL><class>none</class>
<soql>select ContentDocument.latestpublishedversionid from contentdocumentlink where linkedentityid='{{!ObjectId15}}' AND (ContentDocument.FileExtension LIKE '%jpeg')
</soql>
<column prefix="<img src='/sfc/servlet.shepherd/version/download/" postfix="' width='150px' />">ContentDocument.latestpublishedversionid</column>
</lineitemsSOQL>
}}-->[/code]

Image Attachments

For image attachments, use:
[code lang="html"]<!--{{!
<lineitemsSOQL><class>none</class>
<soql>SELECT Id FROM Attachment WHERE ParentId='{{!ObjectId15}}' AND (ContentType LIKE '%jpeg')</soql>
<column prefix="<img src='/servlet/servlet.FileDownload?file=" postfix="' width='150px' />">Id</column>
</lineitemsSOQL>
}}-->[/code]

Note: This only allows you to merge IMAGES from files or attachments. You cannot use this method to merge PDF files or attachments into your S-docs PDF.

image, images, picture, pictures, attachment, related list

Adding Page Breaks to Your PDF

By Documentation, General Solutions, S-Docs Cookbook No Comments

Insert Page Breaks With The Template Editor

When creating visually pleasing PDFs, it is essential to have control over exactly where the content of one page ends and the content of another begins. To insert a page break into your document, simply place your cursor where you want the page to break and click the Page Break button.

Insert Page Breaks With Code

You can also insert the following code into the Source of the template editor wherever you would like a page break:

[code lang="html"]<p style="page-break-after:always;"> </p>[/code]

Live Edit: Allow Users to Edit Generated Documents

By General Solutions No Comments

Check The "Allow Edit" Checkbox

If you find yourself in need of editing a document after it’s been generated, no worries! The S-Docs Live Edit feature enables end-users to open and edit generated documents wherever they're linked in Salesforce.

Note: This feature is only available for PDF, PDF-Upload, HTML, and DOC templates.

To enable this feature, navigate to the template record detail page for the template that should be editable after generation. Click the dropdown arrow on the right, and then click Template Editor to open up the S-Docs template editor.

Navigate to the Document Options tab, then check the Allow Edit checkbox, which can be found under the Attachment & File Options section.

After you save your template, an edit link (a pencil icon) will appear next to the document each time it is generated.

Note: If you are using S-Docs version 4.325 or below, the Allow Edit checkbox will not be available within the template editor. It will instead be available as a field on the template creation page & template detail page.

Generate and Edit A Document

In this example, we’re going to generate an invoice from an Opportunity. The process is the same as any other document generation. We’re going to select the “Standard Invoice” document and then click Next Step.

Once your document is generated, you can edit it by clicking the pencil icon. You can also click Emailed Selected Docs to proceed to the email page and make your edits from there, or find the document in the S-Docs related list on the record that you generated the document from.  The pencil icon will appear wherever this document is stored in Salesforce, allowing you maximum editing flexibility. We'll click the pencil icon now.

The live edit screen will appear as follows in a new tab:

You can [1] make edits to your document and use the toolbar to apply styling. [2] Click Save to save your changes, and then [3] click Preview Last Save to preview how your changes will appear in the final document.

Note: If you click the Preview Last Save button before saving, it will display your document without your edits.

If you're not happy with your edits, [4] click Revert Last Save to undo your changes. [5] Click Close to close the edit window and return to the page you started from (in this case, the generated documents page).

That's all there is to it!

Whitelist Profiles for Live Edit

By default, all users with S-Docs licenses enabled are able to edit documents that have the live edit feature enabled. However, you can also disable live editing for all users by default and allow only specific profiles to use the feature.

To do so, navigate to the S-Docs Setup tab by clicking the App Launcher, typing in "S-Docs," and clicking S-Docs Setup in the dropdown menu.

Scroll down to the Other Settings section.  From there, you can [1] enter a new-line delimited list of profile names that should have access to live editing. Then, [2] click Update Settings.  Only users with profiles in the list will be able to live edit documents.

Limitations

While the Live Edit feature is convenient way to modify documents after they have been generated, it does come with a few limitations.

  1. PDF, PDF-Upload, HTML, and DOC are the only file output types supported.
  2. Editing cannot be restricted to certain sections of the document; the Live Edit feature gives users access to edit the entire document (except for PDF-Upload templates. With this format, only merged field data can be edited).

Creating Your First S-Docs Template

By General Solutions, Uncategorized No Comments

Introduction

This document will teach you how to create your first S-Docs template and navigate to the template editor. Since S-Docs is 100% native to Salesforce, creating your first template is a simple process. Any records you create using S-Docs will be stored within the Salesforce cloud. To learn more about the S-Docs template editor, click here. To view the S-Docs template library, which contains free and easy-to-customize downloadable templates, click here.

You can also watch the following video for a more comprehensive tutorial that goes over the different elements of the template editor and how to design a simple quote template.

Video Tutorial

Written Instructions

Create A New Template

To begin, navigate to the S-Docs app by clicking the App Launcher in the upper left corner, and then selecting S-Docs.

Click over to the S-Docs Templates tab. This page will display all of the templates you create. To create a new one, click New.

This will bring up the initial template creation page (not the template editor). To get started quickly, you only need to complete the fields indicated with a red asterisk, and then click the Save button. In this example we will create an opportunity summary sheet from the "Opportunity" object, but you can enter any values you want. All of the fields are explained below.

Template Name: Enter a template Name. This field is required.
Description: Optionally add a description. You should include any keywords that will be useful when searching for this template, because this field and the name field are searched during the document selection step. End users will see this field in the template listings.
Document Category: Optionally chose a category from the picklist. Templates can be grouped together so that a user can browse templates by using a category picklist. If needed, you can later customize this picklist.
Related to Type: Pick an object from the picklist. This is the base or primary object this template will use. If needed, you can customize this list with your custom objects. This field is required.
Template Format: Pick an output format. To support the same document in multiple formats, simply clone the template with a different "Format" field value. This field is required.
Document Version: Use this field to track any internally used version number (or date) for this template. It is only used for reference purposes.
Available for Use: Keep this box checked (it is checked by default). This ensures that the template is visible for new document creation.
Initially Visible: Keeping this box checked (it is checked by default) will make this template visible on initial load of the document creation page based on the object type. Typically, you want to set this checkbox for the 10 most used templates for each object type.
Allow Edit: If you want users to be able to edit this document after it has been generated, check this box. Read more about this feature.

Once you've filled in all of the values to your specifications, click Save. You will be redirected to the template detail record.

Use The Template Editor

From the template detail record, click the dropdown arrow in the top right, then select Template Editor to design your template.

This is a very basic overview of the template editor. For a more in-depth explanation, click here.

This is the WYSIWYG template editor (What You See Is What You Get). Add some text, place the cursor where you want your Salesforce record data to be merged into the template, and then click on the Insert field button.

Select the field you want to insert and click Insert. The editor will add the merge field in the correct syntax into the template editor.

Repeat the above step for other fields. You can also use the editor tools to modify the document. Or, click Source to view the HTML and add your own styles. The customization options are endless. Click Save when done.

You have now created your first template.

Note: You can also insert images, span related objects and create child object line items and add CSS stylesheets. The possibilities are endless!

Automating Emails with Process Builder

By General Solutions, S-Docs Cookbook No Comments

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:

Name: SDocsSettings
ConnectedAppLoginURL:
Production: login.salesforce.com
Sandbox: test.salesforce.com
SD Jobs Batch Size: 45
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).

Generating automated emails with S-Docs Jobs is simple, and using the Process Builder is the quickest approach. For information on automation and batch processing, click here.

Video Tutorial

The following video will go over 2 examples:

  1. Auto-sending a welcome email to new clients
  2. Auto-sending an invoice for won opportunities.

You can also refer to the written instructions below the video for a similar example.

Auto-Generating A Welcome Email For New Contacts

In this example, we will generate an email welcome letter whenever a contact is created by using an S-Docs Job in a Salesforce Process. We'll use 2 templates for this process: an HTML template to fill out the body of the email, and a PDF template for the welcome letter that will be attached to the email. Make sure you specify an email address in the Email Settings tab of the HTML template; typically, you'd want to put {!contact.email} in the recipient field so that when this process is invoked, the email address is automatically specified for each unique contact created. Click here to learn more about creating email templates.

Before you begin, note the names of your templates, as you will need them later.

Note: You can also use a template's ID in place of a template's name for the "doclist" parameter. However, template IDs will change from sandbox to production orgs, so we recommend using the template names if possible. Keep in mind that if there are multiple templates in your org with the same name, all of them will generate if one of them is referenced by your process.

Create A New Process In Process Builder

Navigate to Setup > Build > Create > Workflow & Approvals > Process Builder and create a new Process by clicking New.

Fill in a name and optionally a description for your process. Choose to start the process when "A record changes." Click Save.

Add Your Object

Click Add Object, choose Contact, and start the process only when a record is created.

Add "No Criteria"

Then, we click Add Criteria and set it to No Criteria, since we want our Job to execute every time a new contact record is created.

Add The "Create A Record" Action

Next, click Add Action and choose Create a Record for our action type. Select SDoc Job for our record type.

If you are having trouble finding SDoc Job in the picklist, type in "SD" and SDoc Job will appear.

Add S-Doc Job Field Values

Next, we will add the following 5 field values:

Start JobThe type will be a Boolean set to ‘true’ so that the specified documents will automatically generate (and in this case, automatically email, as we have specified to do so using the Job’s email fields) upon the creation of this particular S-Doc Job record.

Send EmailThe type will be a String with a value of ‘1,’ so that an S-Doc Job record will email the document it generated. If we set this to ‘0,’ an email will not be sent, thus, we will be setting this to ‘1.’

Object ID: The type is a Reference because we are referring to the ID of the record we are creating objects for, and we look up the value "Contact ID." This gives this field the value [Contact].Id, so when this S-Doc Job runs for a newly created contact, it will know that contact's ID.

Object API NameThe type is a String and it is the API name of our objects. In our example, we’re creating this trigger for new contacts, so we store Contact in this field.

Doclist: The type is a String. The value is the comma-delimited list of S-Docs template names that we will be using to generate our documents. Make sure there aren’t any spaces in your comma-delimited list. In our example, Welcome Letter is the name of our S-Doc template for a welcome letter PDF, and Email Template is the name of our S-Doc template for an HTML email.

Additionally, if we wanted this S-Doc Job to be run as a different user, we would click Add Row and add the "Run as User" field. For "Value," we would enter the username of the user we want this Job to be run under.

Then, we click Save and click Activate at the top right of the screen.

All done! S-Docs will now automatically generate and email a welcome letter whenever a contact is created.

Additional Fields

While we only used 5 fields in the process above, S-Docs Jobs also support a number of other fields that you can use to further customize your process.

Email From

Email From allows you to set an org-wide email address as the From address when your S-Docs Job process includes emailing a document.

Email Params

Email Params allows you to add advanced email parameters to your process that are not available to access through standard fields on the S-Docs Job object, such as useExistingNoContactRecord=true.

Incl. Attachments with Email

Incl. Attachments with Email allows you to specify a comma-delimited list of Salesforce Attachment IDs to be included in the email sent out by the S-Docs Job.

Incl. Documents with Email

Incl. Documents with Email allows you to specify a comma-delimited list of Salesforce Document IDs to be included in the email sent out by the S-Docs Job.

Incl. Files with Email

Incl. Files with Email allows you to specify a comma-delimited list of Salesforce File IDs to be included in the email sent out by the S-Docs Job.

Top