S-Docs is a powerful, 100% native tool for automatically merging simple to complex data from Salesforce into data-driven documents. Anyone from admins to developers can get started building S-Docs templates right away. Use this guide to quickly evaluate the tools you can use, what type of Salesforce data you can merge into your templates, and how you can apply logic to those templates to create documents that shine.
Tools Used to Build Documents
There are three main tools that can be used to build S-Docs templates:
- The S-Docs Template Editor (most common)
- Microsoft Office products (Word, PowerPoint, or Excel)
- External PDF Editors
Each tool has its own pros and cons, so be sure to evaluate this guide carefully.
S-Docs Template Editor
The S-Docs Template Editor is a powerful interface for building document templates directly within Salesforce. It's the most common and most convenient method for building templates because:
- It doesn't require the user to leave Salesforce
- It provides easy-to-use wizards for inserting Salesforce merge fields, related lists, and conditional logic blocks with a few simple clicks
- It supports multiple document output formats including PDF, DOC, HTML, CSV, and more
- It allows more advanced users to edit the template HTML/CSS source code for maximum flexibility
The template editor also provides formatting tools similar to those of Microsoft Word (insert tables, page breaks, or images with a few clicks), meaning it's easy to learn no matter your experience level.
Learn more about creating your first template and using the template editor.
You can build S-Docs templates with Microsoft Word, PowerPoint, or Excel, and then upload them to S-Docs for generation. Users more comfortable with Microsoft products may prefer to built templates this way; however, they do come with limitations. Documents built with these tools can only be output as .docx, .pptx, or .xlsx files. Merge fields and related list code must be copied from the S-Docs template editor and pasted into these tools, and require special syntax. Not all S-Docs features are supported. Consult our limitations guide for more information.
Learn more about building templates with Microsoft Word, PowerPoint, and Excel.
You can build PDFs externally and upload them to the S-Docs template editor. Once uploaded, you can drag and drop merge fields and (if applicable) S-Sign fields onto the PDF to merge in Salesforce data. This format is useful for documents that only require simple Salesforce fields merged in; more complex data like related lists and SOQL queries are not supported.
Learn more about PDF-Upload templates.
Every S-Docs template is related to one object (standard or custom) and can easily pull in field and related list data from that object. Since S-Docs is a 100% native app, it also allows you to query data from anywhere in your Salesforce org, even if it's not related to your base object. These queries run as the logged-in user, ensuring no user gains access to data that your permission sets or sharing rules restrict.
Static text is text or other graphical elements in your templates that never change. Typed text, non-related-list tables, and static images will stay the same no matter what record your document is generated from.
Data From Salesforce
S-Docs allows you to insert dynamic data from anywhere in Salesforce. The following lists the main ways Salesforce data is merged into your documents.
Merge fields merge Salesforce field values from your base and related objects into your documents. You can access fields from related objects up to five relationships deep. They are generally written in the following syntax (but variations exist based on template format):
You can also merge in field labels using the following syntax:
You can write merge field syntax yourself or use the Insert Field button to find the correct syntax.
Merge fields can be formatted to display content in customized ways (for example, you can easily format date and currency fields to match your country's standard, or change how checkbox fields display).
S-Docs also provides a variety of special merge fields you can use to insert document metadata like the generating user, date of generation, document name, and more.
Related Lists & SOQL Queries
You can easily insert related list data into your templates using the Insert Related List button. By default, related lists are merged into your documents as dynamic tables with one record per row. However, they can be styled and customized to your liking. You can also filter, sort, and group your related list layout, as well as apply different column attributes to alter the look, feel, and structure of your merged related lists.
You can also use SOQL queries to insert related lists that are not related to a template's base record; you can even name your query and then use the data returned in merge fields throughout the document.
Related lists are not supported for every document format; consult the Understanding Template Formats section of the S-Docs Knowledge Base for more information.
You can easily insert both static and dynamic images into your documents. Static images can be from external sites or your own Salesforce org (as Documents, field data, or static resources). Dynamic images can be from rich text fields or you can build a dynamic URL with a formula field.
Runtime Prompt Input
S-Docs Runtime Prompts collect user input from a form during the document generation process. That input can be merged into your documents using Runtime Prompt merge fields. It can also be used to trigger conditional content.
Component templates are S-Docs templates that can be merged into other templates as merge fields. Component templates allow you to create libraries of prebuilt document sections (such as a terms and conditions clause) that can be inserted into your templates in seconds.
External data (data that's not stored in Salesforce) can also be merged into your document. This is done by writing the external data (as an XML string) to an S-Docs Job record, and then referencing the XML data values as merge fields in your template. Learn more about merging external data into your documents here.
You can format your document to best suit your needs, including adding a header and footer, changing the page size and orientation, and applying formatting to individual merge fields and related lists.
S-Docs allows you to apply conditional logic to your templates to show or hide data, document sections, or even entire pages - based on your business rules.
Conditional logic is mainly applied with the Insert Conditional Logic button in the template editor, which allows you to show or hide data based on field values. You can also apply conditional logic to related lists with the render attribute.
S-Docs can also perform arithmetic functions in your templates to calculate math functions or evaluate time between dates.
Finally, you can use switch statements or the callable apex feature for more advanced logic requirements.
As you can see, S-Docs is a powerful solution for building data-driven documents in Salesforce. Be sure to review other articles in the Inserting & Formatting Data section of the S-Docs Knowledge base for more in-depth information on building stunning documents in Salesforce.
Tags: Format-Specific, Formatting, Images, Merge Fields, Related List, SOQL Query, Template Editor