Now that you've collected the Salesforce data you need for the Sales Quote document using Query Builder, it's time to build the Document Template.
First, you need to create a "Document Template" record in Salesforce. The record connects a file that you plan to use as a template, with the Salesforce data you retrieved in the previous step. The file can be of the following formats:
- To create Document Templates using DOCX or XLSX files, you first need to set up the "Headless" application.
- To create Document Templates using Google Docs or Google Sheets you first need to authorize the Google account.
Document Template links Document Solution with a specific file. This connection enables you to utilize queried fields from the Query Builder in the file and modify those fields according to your requirements.
You can have multiple different Document Templates on one Document Solution and select the needed Template each time you generate a document. In fact, in this tutorial, you will use the same Document Solution with DOCX, XLSX, Google Docs, and Google Sheets templates.
On Maven Documents, Microsoft and Google documents work a bit differently. We will now show how to create a Document Template using each type, so you can see what we are talking about.
Now, we will show you how to create a Document Template with a DOCX file connected. While guiding you through, we will highlight places, that are different from Google templates.
In the "Maven Documents" app, open the "Document Templates" tab and click New.
The "New Document Template" screen pops up. It has the following fields on its layout:
Name the Document Template "Sales Quote Template" and in the "Document Solution" lookup field, select the created "Sales Quote" Document Solution.
If you would like to place the generated document into a specific folder on OneDrive you can define the path in the "Folder Path" field.
Here are some examples of how you can fill in the field:
If the "Folder Path" value matches the already existing path on OneDrive, the generated file appears there. Otherwise, new folders are created.
The "Description" field can hold additional text information that helps users to work with the record.
In the "Template Type" field, you can select the type of your document. It could be one of the following:
Choose the DOCX type.
Once the type is defined, notice that additional fields appear on the "New Document Template" layout:
You won't be able to define PDF Conformance level and PDF Version on the Google Document Template as this feature is only supported in DOCX templates.
If you want to have a specific name for the generated document you could populate the "Document Title" field with this name. If you leave this field blank, the generated document is named after the file you upload to the Document Template.
The document title can also contain merge fields like {!Opportunity. Name}. So you can start customizing the document from the very beginning.
In the "PDF Conformance level" field you can enter the value that defines the necessary level.
These levels set clear rules and standards for PDF files. It ensures such files are self-contained, work on any device, and are good for long-term storage. These rules cover fonts, colors, metadata, transparency, and other parts of creating and storing PDFs. The goal is to ensure that PDFs look the same regardless of the system or software used to open them.
If you leave the field untouched, the PDFA3a level is applied by default.
The "PDF Version" field defines the version of the PDF specification to which the PDF Document conforms. In this field, you can put the value that represents the necessary version.
If you leave the field untouched, the PDF_1_7 version is applied by default.
The "Locale" field displays such data as currency, numbers, date, and time in the generated document in the format of the desired country's locale. If this field is not specified, the current user's locale is used. In the screenshot below, we used the Croatian locale as an example. Here you can find more information on how to use the field.
The "Template Document URL" field is populated automatically, once you upload the online DOCX file using Maven Add-in.
Click Save.
With these steps passed, you now have the DOCX Document Template record created.
To build a Document Template with an XLSX file, you can follow the same instructions but select the XLSX file instead of DOCX.
- If you have the offline file uploaded to the Document Template, the "Template Document URL" field remains empty.
- If you decide to upload the online file to the Document Template that already has the offline file, the Template Document URL is populated with the respective link, the "Document Template Id" value is changed, but the offline file stays attached to the record.
- If you upload the offline file instead of the online one, the Template Document URL becomes empty, the "Document Template Id" value is changed, and the offline file is attached to the record.
Although the "Template Document Id" field is not shown on the DOCX Document Template layout, it still holds the corresponding value in the background. The field gets automatically populated with the ID of the DOCX or XLSX file, once you upload it to the Document Template.
The "Template Preview" tab on Azure templates won't have the file preview, cause this feature works only for Google Docs and Google Sheets template types.
The following step is to style the created document using Maven Add-in. Use the links below to read the instructions:
Follow the steps below to create a "Document Template" record:
In the "Maven Documents" app, open the "Document Templates" tab and click New.
The "New Document Template" screen pops up. It has the following fields on its layout:
Name the Document Template "Sales Quote Template" and in the "Document Solution" lookup field, select the created "Sales Quote" Document Solution.
If you would like to place the generated document into a specific folder on Google Drive you can define the path in the "Folder Path" field.
Here are some examples of how you can fill in the field:
The ID of the folder can only be used at the beginning of the path. If you place it second or further, the value is recognized as a string and you'll get the folder named after the "ID" value.
If the Folder Path matches the already existing path on Google Drive, the generated file appears there. Otherwise, new folders are created.
If the field is left empty, the generated file appears in the same folder as the template document.
The "Description" field can hold additional text information that helps users to work with the record.
In the "Template Type" field, you can select the type of your document. It could be one of the following:
Choose the "Google Doc" type.
Once the type is defined, notice that additional fields appear on the "New Document Template" layout:
Such fields as "Template Document Id" and "Open Template" are only shown on Google Document Templates. That's because you can't manually put an ID of Microsoft files or preview such files on a "Document Template" record.
The "Template Document Id" field holds the ID of the file that you are going to connect to the Document Template.
Paste the ID of your Google Docs into the "Template Document Id" field.
You can find the ID value of your document in the URL of the document. For example, for Google Docs it would look something like this: `https://docs.google.com/document/d/ID/edit`, but instead of "ID", your document ID is displayed there.
If you want to have a specific name for the generated document you could populate the "Document Title" field with this name. If you leave this field blank, the generated document will be named after the Document Template.
The document title can also contain merge fields like {!Opportunity. Name}. So you can start customizing the document from the very beginning.
The value in the "Open Template" field appears after you save the template. This field will be populated with the link to the Google Docs that you defined in the "Template Document Id" field.
The "Locale" field displays such data as currency, numbers, dates, and time in the generated document in the format of the desired country's locale. If this field is not specified, the current user's locale is used. In the screenshot below, we used the Danish locale as an example. Here you can find more information on how to use the field.
Once all the fields you need are populated, click Save.
This is how you can create the "Document Template" record using the Google Docs file. Once the record is saved, you can open the connected document directly in the new browser tab by clicking Document Template in the "Open Template" field.
Another option is to preview the template on Salesforce by clicking on the "Template Preview" tab.