Article published on the 20th of January, 2023.
Creating documents from templates have long been a key feature of WorkPoint. Traditionally, these have been created using a wizard, but after version 4 of WorkPoint 365, this framework is being deprecated. The process of creating documents from templates is created and maintained using WorkPoint Automate moving forward.
This article aims to provide guidance on how to set up a process in WorkPoint Automate which allows users to create documents from templates.
Using WBA requires a WorkPoint solution on version 4 or newer.
3. Configuration of "Create document from template" process
In this section, we will combine a series of steps inside a process we are going to name "Create document from template". For your implementation, you can use whatever name you like.
We are going to use the following step types in our process:
- Search form
- Item form
- Create item
We are going to use the Search form to be able to search for and select a template to create a document from.
We are then going to use the Item form to provide a name for the document we are going to create from the template.
The Create Item step is going to perform the action of actually creating the document from the selected template using the name provided in the Item form.
First of all, we are going to create a new process:
- For the title of the process, we type in "Create non-disclosure agreement from template".
- Since the process will be executed manually by a user, we select to create a "User process". We also place the process in a process group called "Item Processes", as the process relates to create a document, which is a type of item. This step is optional, but it is generally a good idea to organize processes into groups in order to quickly be able to find them later.
- To begin adding steps to the process, we click the "Begin" button.
3.1. Adding the Search form
The first step we are going to add the process is the Search form:
- To add the Search form, we click the "Add new steps" button.
- In the "Add a step" side panel, we search for and select the "Search form" step.
- To add the step to the process, we click the "Add step" button.
The step is now added to the process, and we can start editing it's options:
- For the title of the step, we type in "Select template". This is the title that will be displayed to the end user when this step is active in the process.
- In the "Description" field, we type a fitting description for what the step is used for.
- The name of the step needs to be unique in the process, meaning we cannot have two or more steps with the same name. The system provides a name for the step (SearchForm), but we rename it to "SelectTemplateForm".
- In the "Options" tab, in the "Allow multi select" field we select "No". Doing so will make it impossible to select multiple templates in the form. Creating multiple documents from templates is covered in a separate article.
- In the "Allow optional selection" field, we select "No". This forces the user to select a template before being able to move on to the next step in the process.
- In the "Configure tabs" section, we click "New configuration" and select "Templates".
- Once we have added the "Templates" configuration, we can select from which template library we want to be able to select templates from. In our case, we only have one template library, which we select.
- We can also select a default view from the template library to display in the search form.
- In the "Show as" field we select "Default". Another option is "Grouped" which will display the available templates in a grouped view.
- In this demonstration, we select to not show the language filter on in the search form. If this was set to "Yes", users would be able to filter templates based on the languages set for each template in the template library.
- In the "Language" field, we can select to only show templates marked with a specific language. In this case, we leave this field blank to show all templates.
- In the "Business module filter" field we can select to only show templates related to a specific business module. In this case, we are going to create a company NDA document from a template related to the "Companies" module.
Next, let's move on to the "Target" options:
- In the "Target" tab, we can select where to store the new document created based on the template. In the "Check existing" field, we select "No".
- We'd like to store the document on the current entity, which is residing in the "Companies" module, which we select.
- To define on which company to store the document on, we provide the ID of the current entity from the context.
- In the "List" field, we can select in which list/library on the select entity to store the document. In this case, we select the "Documents" library.
- In the "Default folder" field, we can type in the name of a folder in the selected list/library to store the document in. In this case, we leave this field blank.
That's it for the configuration of the "Search form" step.
3.2. Adding the Item form
Next, we add the "Item form" step to the process:
For the Item Form, we set the following General settings:
This step is going to be used by users of the process to provide a name for the new document created from a template.
We configure the settings as shown here:
- We are going to create the document on the Companies module and on the current entity.
- We are going to put the new document in the "Documents" library using the "Document" content type.
These four settings will ensure that users will see the fields shown in the table in pt. 26 in the form when creating a new document from a template.
- In the list of fields which will be shown in the form, we have modified the properties of the "Name" and the "Document Classification" fields. The only modification we have made is that we have made these fields required, meaning users will have to provide information in these fields in order to move on to the next step in the process.
This is all we need to set for the Item form.
3.3. Adding the Create item step
Next, we are going to add the "Create item" step to the process:
For the Create item step, we set the following General settings:
As the description we have typed in suggests, this step is used to actually create a document based on the selected template. In the "Step Input" field, we select the output from the "Document information" step, which is the Item form we just configured previously. This is selected, so that we can use the meta data users provide in the Document information form for the new document we create.
In the "Options" tab, we configure the settings as follows:
- In the "Business module" field we select the Companies module and in the "Entity" field, we select the ID of the current entity from the context.
- In the "List" field, we select the Documents library and for "Content type", we select "Document".
In the "Template" tab, we configure the settings as follows:
- In the "Template list" field, we select the template library which holds the template which we want to create a document from. In this case, our template is stored in the generic Template Library.
- In the "Template item id" field, we need to provide the ID of the template we want to created a document from. In the very first step of this process, users select a template and we can simply take the ID of the template they select in that step and use that ID in the "Template item id" field. To do this, we need to use an adaptive expression, which we can do by clicking the "Advanced" button.
- In the "Advanced" panel for the Template item id field, we open the "Advanced" view and type in the following adaptive expression:
Using this expression, the ID from the template the user selects in the "Select template" step will be passed into the "Template item id" field of the "Create template" step, which is exactly what we need.
We can now save and publish the process:
- To save and publish the process, we click the "Save as draft" button, followed by "Publish" button.
4. Executing the process
In this section, we will execute the Create document from template process.
To do this, we have set up a My Tools button on the Companies module which will start the process for us:
- In the My Tools panel, we click the button to start the Create document from template process. This this demonstration, we are going to use the process to create a "Non-disclosure agreement" document from a template, so we have titled the button accordingly.
- In the "Select template" form, we can select from the various templates we have in out template library. In this case, we only have one: the "Non-Disclosure-Agreement-Template", which we select.
- To continue to the next step in the process, we click the "Continue" button.
Tip: If you want to see a preview of the various templates, click the "Preview" buttons.
- In the "Document information" form, we fill in all necessary information, e.g. name of the new document and a classification.
- To continue to the next step in the process, we click the "Continue" button.
The "Create document" step now creates our document from the select template with the name and classification provided:
Once the process is finished, we can click the "Close" button:
- To close the process, we click the "Close" button.
Now let's take a look in the Documents library of the company on which we ran the process:
We can see that our document was created, and if we open it, we can see that all the information from our template is in the document. It also includes whatever information has been merged from various sources: