Applies to version 2019.1; author: Józef Cyran
Introduction
WEBCON BPS allows you to generate/update Word documents (e.g. invoices, contracts) based on a template that inserts data from the system (e.g. data from the workflow instance that caused the file to be created) and also convert them to PDF (if necessary). To do this, you need our Word add-in to be downloaded from WEBCON BPS Portal.
For more information about Word add-in see: WEBCON BPS add-in for MS Word.
The next step is to connect this add-in to the BPS server – go to the WEBCON BPS tab (in Word), click the “User settings” option, enter the server URL and click the “Connect” button.
Then select the “File Generation Templates” option - you must indicate the application, process, document type and form fields from which the data for printing will be loaded.
Business case – Car Fleet Management
The simple application used for equipment rental (IT and office) has been created. The main process generates a contract ready to be signed.
The Equipment rental process consists of several steps. An employee selects the equipment, fills out their data and goes to the control step (here, depending on the type of equipment rented, the request goes to the IR or HR department). After approval by the appropriate department, an action of Word generating was added to both paths, followed by the action of converting this file to PDF.
Important! An action template was created from both actions - action templates allow you to use the same action configurations multiple times in the process.
The following table consists of the form fields which have been used in the process. The “_equipment department” is a technical form field and the “Name and surname” field should be a “Person or group” or “Picker field” type.
The selected equipment is a field of any type of data source. In the configuration, set the appropriate columns to complement each other in the “Equipment type” and “Equipment values” fields.
At the next step, an employee selects a period of time and fills out other data. This information will be included in the contract.
The instance goes to the “Approval by IT” step based on the “Equipment type” field.
The other solution (available in 2020 version) is to create one “Approval” step and assign the task to the appropriate department in the path configuration in the “Task creation” tab based on the business rule. It allows you to avoid creating two separate steps.
The “Approval” step allows you to approve or reject an request – let’s focus on approval paths. Set the “Generate/Update Word file” action (screen below).
There are three operating modes: New file, Update file, New file for item list row. When it comes to the last one – the action generates one document for each row. So in the file name, file description and DOCX templates you can use tags such as {S:DET_ID}, {S:DET_LP}, {S:DET_Att1}, etc.
There are two methods of selecting the template:
The third method is to create a document template (dictionary) process. In version 2020, this can be done automatically using the wizard. It has a single step and will have only one instance of a given form type. Add the template (as an attachment) to this instance.
To select the template, use the SQL query:
Where ATT_WFDID is the ID of the dictionary process instance.
Then configure the “Result” tab – in the File name enter the form field from the form.
The “Converting Word to PDF” action works similarly, except that uses the already generated Word document as the source document. It is important that it is below the Word generation action - the actions are always performed in the order from top to bottom.
The action of converting is analogous to the generation one - you can again select the method of selecting an attachment and its name in the Results tab.
Creating a template
The template added to the dictionary process as a template:
The form fields that have been indicated in the “File Generation Template” window of WEBCON BPS add-in.
The window with form fields that can be inserted is one the right side of the screen. The User settings option used to configure connection to the BPS server is located on the ribbon at the top of the screen.
Below there is a generated Word template:
Summary
The actions for generating documents allow for wide customization and automation of work that is often menial and repetitive, such as manually filling and formatting documents. When you need only the PDF file, a good solution is to use the Delete attachment action (placed after the action of PDF generating – since actions are executed in the order in which they are defined on the action trigger).