This article will help you:
- learn about typical use cases for document automation
- understand which document generation method is better suited for your use case
- automate your document via placeholders
- make your generated documents available as download, email attachment and in a data view
What is the Create document action node?
Use the Create document action to generate a downloadable PDF or Microsoft Word file (DOCX) for your users. For example, you can populate the document with the user’s responses to generate a form or a contract. You can also use the document to provide a receipt of your user’s interaction with the module.
Why would you use the Create document action node?
Contract automation
Using the Create document action, you can create contracts that are based on multiple building blocks. Depending on the responses given by the user, different building blocks will be placed in your contract. You can also fill the contract using the answers the user has given. Your module could be a form where the user enters personal data and this data will be then placed in the contract.
Response summary
Using the Create document action, you can make a document based on the list of responses you have collected from your user.
How to use Create Document Action
First, you will need to add a Create document action to your module and upload a template file. After the template file is scanned for placeholders, you will need to assign values to each placeholder. Finally, you need to decide on a way for the user to access the downloadable document.
Follow the directions below to add a Create document action to your module. We suggest that you add this action towards the bottom of your decision tree.
- Click the plus icon + on a node.
- Select New Action.
- In the attribute editor that opens, select Create document.
- Double-click New document to name your node. This will serve as the file name of the document your users receive unless you choose to provide an optional file name via the DOCUMENT FILE NAME field.
- Select a Format for your document (DOCX or PDF).
- Select a Template from the drop-down menu or upload your own.
- The template will be scanned for placeholders and a new section PLACEHOLDER will appear.
- Automatically map any matching values and placeholders by selecting the Map Values to Placeholders option, if shown.
- For any remaining placeholders not matched, assign the appropriate value to each placeholder by referencing the corresponding Input or Action node in the drop-down menu.
Learn more about adding content to your document, selecting an output format, as well as choosing and modifying a template in the Parameters section below.
Add content to your document
Now that you have learned how to add a Create document action to your module and how to make the document accessible to the user, we will focus on how to fill your document with content.
There are two ways to go about adding content to your document:
Option 1: One Placeholder in a template with single Text Block Value node serving as collecting point (One Value only - OVO)
The first option is to place one placeholder in your template that receives its information from a single Text Block value within your module. This Text Block node may store information from a number of other Input or Action nodes through the use of referencing. This way you require little to no upkeep of your template. This does mean, however, that you are very restricted in terms of formatting as you are limited to the formatting options available in the content editor.
All input is stored collectively in the Text Block value "Document Result".
The Text Block value "Document Result" is assigned to the Placeholder {{Result}}.
Option 2: Multiple Placeholders in a template for more styling options (Bring-your-own-template BYOT)
The other option is to mark specific words or sections within your template as placeholders. This gives you great control over the styling of your document. It does mean, however, that information is scattered all over the module rather than collected in a single Text Block value. Note that after any changes or amendments to the template have been made, the template needs to be re-uploaded to the Create document action. Re-uploading will not force you to refill existing placeholder references. Identical placeholders will be recognized and their assigned Input and Action nodes will remain referenced. We recommend this option as best practice.
Add placeholders and placeholder statements to your template
No matter the option you choose, you will need to properly prepare your template prior to uploading it. This means adding placeholders to your template:
You create placeholders by using two sets of curly brackets “ {{ }} ” in combination with text. For instance, if you wanted to create a placeholder for a value "country", it could look something like this: {{country}}.
If there are text blocks you would like to avoid completely, you can use the {{\dl}} statement after your placeholder, e.g., {{country}} {{\dl}}. Find out more here on how to avoid empty lines or paragraphs in Microsoft Word Documents. Similar statements can also be used for tables in a Microsoft Word document. The {{\dr}} statement deletes an empty row in a table, whereas the {{\dc}} statement deletes an empty column.
Now, if you save your template as a DOCX file and upload it via the Template drop-down menu in the attribute editor to your Create document action, the template is scanned and all placeholders are identified.
If there are any placeholders that are exact matches for values in your module (e.g. there is a placeholder {{Landlord Name}} and an input node called 'Landlord Name'), BRYTER will tell you there are exact matches and offer an option to 'Map values to placeholders' for these.
To make it explicit when using multi-input nodes or case databases you can write in word {{MultiInputNodeName --> Sub-inputName}} or {{CaseDatabase --> CaseDatabaseFieldName}} respectively and BRYTER will recognise those and suggest to map them automatically.
Selecting this will then populate the selection beneath each relevant placeholder with the matching value, allowing you to amend the assigned value later if you need to.
For any placeholders in your document template that don't exactly match a value, you can assign corresponding values to your placeholders through referencing. In the create document action node, authors will find two different tabs: UNMAPPED and MAPPED. This makes it easy for authors to spot which placeholders have not been mapped yet.
A drop-down menu will appear below each placeholder. Use the menu to select and assign the node containing the relevant value. These referenced values are most likely derived from a Text Block value or an Input node.
Avoid empty paragraphs or lines
If you face the issue of empty lines in your document, take a look at this article on how to avoid them.
With the latest improvements, you do not need to initialize a node that is updated later in your module. A placeholder that has not been populated, for example, because the input node was set to optional, will not appear in the generated document. In order to avoid the empty line, please add the {{\dl}} statement.
Make your document available for download in the module
Now that you have created a document and added placeholders to your template, the next step is to make it accessible to your users. You can send the document out as an email attachment or by providing a download link. While you can create a download link in any node placed after the Create document action in your module, we recommend that you create the download link in your Result Node. In the CONTENT field of your Result Node, simply reference your created document by typing “@” and selecting the appropriate item from the drop-down menu. A button with a download link will appear, as shown below.
Send your document available as attachment in an email
If you want the document to be attached to an email that is sent to the end-user or yourself, add a Send Email action node and select the correct document tickbox below the email body content field.
Make your document available for download in a data view
If you want to make generated documents available in a data view, ensure that you are saving the generated document in a case database. In the data view associated with the case database containing the file, select the field with the document. The document can now be downloaded from the data view by your end-users or yourself.
Parameters
DOCUMENT FILE NAME (OPTIONAL)
In the field DOCUMENT FILE NAME field you can assign an optional name for the downloadable file. If you leave the field empty, the file name will coincide with the name of the Create document action node. Note that the name is case-sensitive.
FORMAT
In the Format drop-down menu, choose between DOCX and PDF to determine the output format of your document.
TEMPLATE
Templates not only determine the styling of your document. Templates also determine the placement of the collected user input from your module. Select a Template from the drop-down menu or upload your own, as shown below. Note that only DOCX files are accepted at this time.
Open a Microsoft Word document to create a custom template, as shown below.
Add text and formatting to your template. Create placeholders by placing text between two sets of curly brackets “ {{ }} ”. For example, a placeholder for the value "country" could look similar to this: {{country}}. Refer to the picture above for more examples.
Once you have created your template, save it as a DOCX file and upload it via the Template drop-down menu in the attribute editor.
PLACEHOLDER
The PLACEHOLDER parameter is exposed once you upload a template containing placeholders. A template can store anywhere from one to many placeholders. Within your Create document action, each placeholder will be followed by a drop-down menu. Use the drop-down menu to assign the relevant value to the placeholder by referencing the corresponding node or action.
Limitations and Troubleshooting
- saving a new template with the same name will override the existing template
- if you struggle to upload a template document and receive an error message, try clearing your cache and deleting cookies in your browser, or consider using a private incognito browser tab
Continue with the next step here: Case Databases
Keywords: {}; {{}}; brakets; {{; }};