Now that you've collected the Salesforce data that you need for the Sales Quote document using Query Builder, it's time to build Document Template. With Maven Documents that comes easy as well.
First, you need to create a Document Template record in Salesforce, which connects a Google Docs, Google Sheets, DOCX, or XLSX file, that you plan to use as a template, with the Salesforce data you pulled in the previous step. If you have successfully authorized the Google and Microsoft accounts with Maven Documents, you can create templates using Google Docs and Google Sheets, save them on Google Drive, and then use them for the document. You also have the option to authorize the Microsoft account and grant Microsoft Azure API access to the Maven Documents application, so you can directly upload online or offline DOCX or XLSX files to Salesforce.
As we've mentioned, Document Template links Document Solution to a specific file. That allows you to use queried fields from Query Builder in this file and modify them to the business requirements.
You can have multiple different Document Templates for one Document Solution, and select the needed Template each time you generate a document. In fact, in this tutorial, you are using the same Document Solution for Google Docs, Google Sheets, DOCX, and XLSX Templates.
On Maven Documents, Google and Microsoft documents are a little bit different to work with. We will now show how to create a Document Template for each type, so you can see what we are talking about.
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 window appears on the screen. It has Name, Document Solution, and Template Type fields.
Name Document Template Sales Quote Template and in the Document Solution lookup field, select Sales Quote.
In the Template Type field, you can select the type of your document. It could be one of the following: a Google Doc, Google Sheet, DOCX, or XLSX file. Choose the Google Doc type.
Once the type is defined, notice that 4 additional fields appear in the New Document Template window: Template Document Id, Document Title, Open Template, and Folder Path.
Such fields as Template Document Id and Open Template are only shown on Google Document Templates, As you can't manually put an ID for Microsoft files or preview them 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 file 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, you’ll have your document ID 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.
Note: It is important to remember, that the document title can also contain merge fields like {!Opportunity. Name}. So you can start customizing the document from the very beginning.
If you would like to put the generated document into the 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 put it in the second place or further, the value is recognized as a string and you'll get the folder named as the ID.
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 where the template document is located.
As you can see, the value in the Open Template field will appear 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.
Click Save.
This is how you can create the Document Template record using the Google Docs file. Once the record is saved, you can either 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 right there in Salesforce by clicking on the Template Preview tab.
Now, we will show you how to create a Document Template with a DOCX file connected. While guide 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 window appears on the screen. It has Name, Document Solution, and Template Type fields.
Name Document Template Sales Quote Template and in the Document Solution lookup field, select Sales Quote.
In the Template Type field, you can select the type of your document. It could be one of the following: a Google Doc, Google Sheet, DOCX, or XLSX file. Choose the DOCX type.
Once the type is defined, notice that 4 additional fields appear in the New Document Template window: Document Title, PDF Conformance Level, PDF Version, and Folder Path.
You won't be able to define mentioned PDF Conformance level and PDF Version on 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 will be named after the file you upload to the Document Template.
It is important to remember, that 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 stands for the needed level.
These levels set clear rules and standards for PDF files to make sure they are self-contained, work on any device, and are good for long-term storage. These rules cover things like fonts, colors, metadata, transparency, and other parts of creating and storing PDFs. The aim is to ensure that PDFs look the same no matter what system or software is used to open them.
If you leave the field untouched, the PDFA3a level will be 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 needed version.
If you leave the field untouched, the PDF_1_7 version will be applied by default.
If you would like to put the generated document into the 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:
Click Save.
If the Folder Path matches the already existing path on OneDrive, the generated file appears there. Otherwise, new folders are created.
With these steps passed, you will now have the DOCX Document Template record created.
Once the file is uploaded to the Document Template, one more field appears on the layout called Microsoft Template URL. It is populated automatically once you upload the online DOCX or XSLX file to the corresponding Document Template.
- If you have the offline file uploaded to the Document Template, the Microsoft Template URL field remains empty.
- If you decide to upload the online file to the Document Template with the offline one, the Microsoft Template URL is populated with the respective URL, the Document Template Id value is changed, but the offline file stays attached to the record.
- At the same time, if you upload the offline file over the online, Microsoft Template 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.
Next, you are going to style the created document using Template Builder. Use the links below to read the instructions on building your document with Template Builder at hand: