What is this?
The ability to insert a set of text elements into a template based on the choices made by a User.
When and where can this be used?
This feature is very similar to what we refer to as a 'built template'. By this, we refer to a template being constructed of a base template containing the basic formatting and main body of text. Any number of texts elements can be added to the base template, thus creating a final document.
A text element can be re-used in multiple documents and, going forward, the text element only needs to be maintained in one place. Whenever a User generates a new document which uses this text element, the latest version of the text element uploaded by the Admin will always be used.
A document put together dynamically when a User creates it in this manner.
A document can 'subscribe' to specific text elements, or the text elements can be inserted based on the choices made by the User.
Examples of documents where this can be used:
- Sales quote - products and descriptions inserted based on Sales Agent choices.
- Employee contract - the main body text is 90% the same, and the remaining 10% is based on the employee.
- Proposal - based on which products and services are included in a proposal, the relevant legal disclaimers are inserted.
For creating complex documents where one or more text elements are inserted based on the choice of a User, Templafy can insert text elements into content controls.
In this article, we will use the example of different disclaimers for different countries. A User selects a country, and Templafy inserts one or more text elements based on that choice.
Basic knowledge of the following is required:
The set up for this example will contain 4 steps. Setting up the Text Elements, setting up the Data Source, setting up the User Form and setting up the Template.
Setting up the Text Elements
First, decide on the data you want to insert into the Template based on the user choice. In this case, it is legislation, disclaimers, laws, and guidelines based on different countries. We split these up into individual Word documents, saved and given a recognizable name. You should end up with something looking like this:
These documents are then uploaded as text elements to Templafy. Note that any folder structure is recognized, and you can upload the documents as a zip file.
For the purpose of this exercise, the 'asset id's' need to be extracted from the uploaded text elements. This is done by opening the text element in Templafy, and extracting the number visible in the URL. It will be between / and ?
Every text element will have a unique Asset ID, and we need to create a list of them. The best practice is to make a separate list, linking descriptions to the id's. This can also be achieved in the Data Source, as seen below.
Setting up the Data Source
In the Data Source, we need a column to select the variable (in this case, country) and the Asset id's of the text elements which relate to that country. Note that the description text only has the purpose of recognizing which text element the id belongs to. Different variables can have different amounts of texts.
Setting up the Form
Setting up the form is straightforward. A new form is created in the form editor. It can be attached to the templates to exploit the functionality described in this article.
- Give the form a recognizable name.
- Select the DropDown type, make it required if necessary.
- Select the Data Source created in the previous step.
- Select the column containing the variables, in this case 'country'.
Setting up the Template
It is possible to set up the template starting with an existing document that already has formatting, but for this example, the template is blank.
For inserting text elements, Content Controls are used. These will be where the eventual text is inserted, be it the header, footer, or body of the document. The tagstring used looks like this:
This tag inserts a text element based on an asset id. The asset id comes from a data source, and is based on the form attached to the document. Based on the choice of the user, it relates to a certain row of the Data Source. 'Text1' is the name of the column that the string relates to.
The maximum amount of Content Controls used by any of the variables are inserted into the Template. On creation, when the text is inserted, the excess Content Controls will be deleted.
When the Template is configured, upload it to Templafy and attach the form we created earlier.
You now have a Template with Dynamic Text Elements!