You are here:
Omnistudio Document Generation Document Templates
A document template defines the structure, content, and format of generated documents. You do most of your document authoring when you create templates. You can create Microsoft Word or Microsoft PowerPoint documents that contain formatted text, including tables, paragraphs, columns, and images. These documents can also be converted to PDF format.
You can associate document templates with input JSON data, which can come from any source. The JSON input can come from a Omnistudio Data Mapper extraction step within the Omniscript, or by collecting data from the user in the Omniscript. A remote call can pass the JSON when generating the document. Variables, also known as tokens, reference the input JSON data in the text. The data is merged into the document during the generation process.
Documents can be generated as part of an Omniscript-based guided interaction flow. Two sample Omniscripts are provided, and you can customize them. You can then convert the document to PDF or Microsoft Word to access within the Omniscript. You can also attach the appropriate object record or even email it to someone. You can also create your own Omniscripts, Integration Procedures, or Apex classes to generate documents.
Each document template record must have a unique name. You can create multiple versions of a document template, but only one version can be active at one time. You can also clone, activate, and deactivate templates.
Document templates offer these advantages:
-
Document generation isn't tied to any particular object. You can generate documents using data extracted from any object, or data that isn’t stored in objects, such as data from an Omniscript.
-
You can generate documents that use advanced formatting. For example, you can create one section for order line items that are devices and another section for order line items that are plans. You can display product attributes in documents, even if those attributes aren’t storied in the order line item fields.
-
You can display repeating content in a generated document. You aren’t limited to line items of an object such as a Contract, Order, or Quote. For repeating items, you can display or hide individual line items based on conditions. For example, you can create a grid that displays only network products and their prices, or only active contracts associated with an account. To display repeating content, use a repeating content document template section.
-
You can use Data Mapper formulas to specify criteria for displaying information. You can use any token from the template to build the formula, or you can define new tokens within the formula. At runtime, these formulas are evaluated based on data passed to the tokens. Then, the template section may or may not be displayed based on the formula.
-
You can use the item section for any type of item list, not only for line items. Display any type of grid, or table, as long as the input is available in a JSON array. For example, you can display price lists or rate tables.
-
You can filter individual line items or repeatable content items to display in a document. For example, from a set of quote line items, you can display devices in one table and services in another. Use a formula to filter the type of line items to show.
To get started building your document generation templates, follow these instructions:
- Create a Microsoft Word or Microsoft PowerPoint Template for Omnistudio Document Generation
Using Microsoft Word or Microsoft PowerPoint, create documents that contain formatted text, including tables of contents, tables, paragraphs, columns, and images. You can also include tokens, or variables, to merge data from a JSON source when you generate the document. - Tokens in Microsoft Word or Microsoft PowerPoint Documents
You can insert multiple types of tokens in a Microsoft Word or Microsoft PowerPoint document template, such as variables, repeating content, condition evaluation, dynamic images, hyperlinks, and rich text. During document generation, tokens are replaced with actual data in the generated document. To avoid incorrect token replacements, use unique token names for each object level. If both parent and child objects use the same token name (for example, {{IMG_image1}}, and the child token is empty, the system may insert the parent’s value into the child section during document generation. - Manage Document Template Versions for Omnistudio Document Generation
When you create a new version of a document template, the settings and Microsoft Word or Microsoft PowerPoint file from the previous version are copied to the new version. You can delete the file and upload a new file if necessary. - Fonts for Server-Side Document Generation
Server-Side document generation supports a specific set of fonts for Document Templates. Custom fonts aren't supported. - Using a Custom Class in Templates for Omnistudio Document Generation
You must include the following when you create a custom class to use in a Microsoft Word or Microsoft PowerPoint document template. - Export and Import Document Template Custom Classes for Omnistudio Document Generation
If a Document Template uses a custom class, and you want to export the template from one org and import it into another org, you must move the custom class first. Importing a Document Template fails if the target org can't find the custom class associated with it. - Using Dynamic Hyperlinks, Rich Text, Images in Client-Side Document Generation
Use hyperlinks, rich text, and image tokens in document templates to insert dynamic URLs, rich texts and images in client-side generated DOCX and PDF files. - Using Dynamic Hyperlinks, Rich Text, Images in Server-Side Document Generation
Use hyperlinks, rich text, and image tokens in document templates to insert dynamic URLs, rich texts and images in server-side generated DOCX and PDF files.

