Skip to main content
Version: 2023 R3

Generate/Update a Word file

The action associated with instance workflow allows you to generate .docx files based on previously created templates.
To use this feature, first create a file template and then configure relevant actions in a given step of the required workflow. An additional functionality is the ability to save such files directly as attachments to a BPS instance.

The action configuration window is divided into two tabs: Template and Output.


A template is a .docx file in which you can enter variables and add image fields using dedicated add-ins for MS Word (Word Classic and Word Modern). Variables and images can also be entered in template headers and footers.
Users also have the option to generate .docx files for each row of a selected Item list. In such case, it is possible to use variables relating to an Item list row, in a file name template, file description template, and a .docx template.

The template prepared in this way should be included in the Document templates process or added as an attachment to the selected workflow instance. The next step is to configure an action in a selected step. This is done in the same way as for the Generate an HTML printout and Generate a PDF file actions.

If the action is configured correctly, the previously created template, complete with the corresponding form data, will be added to the workflow instance.


1. Mode

The field allows you to determine whether the action will result in the creation of a new file, a new file for Item list row, or update of an existing file.

2. Item list

Active, if the Create new file for item list mode is selected. The dropdown list gives the names of all Item list form fields available in the current process. Select one of the Items list based on which .docx files are to be generated.

3. Template

The field allows you to indicate a place from which the template will be downloaded. Three options are available here:

  • From URL – any link allowing to download a document with anonymous access, e.g. http://intranet/workflow/documents/template.docx,
  • From attachment – an existing attachment is selected as a template in which changes are made,
  • From document templates process – a template is specified by means of an ID of a document located in the document templates process. An ID is a value in the following format: /DOCTEMP/GUID/filename, where:
    • DOCTEMP – a fixed name specifying document templates process,
    • GUID – a template ID from an ID field available in the process form,
    • filename – an optional file name.

If the option From URL is selected in the Template field, provide the URL at which the template is available.

5. Support old templates

The action mode available for users who used system version 2017.1 and lower prior to the system update. The mode allows users to type variables (e.g. {WFD_ID}) directly in the template text. In the case of new, currently supported templates, only elements entered on the template by means of WEBCON BPS add-ins for MS Word (i.e. “docproperties”) are accepted.

6. Attachments to be processed

If the option Update existing file is selected as an action Mode or the option From attachment is selected in the Template field, indicate the attachments to be processed.

7. Category

The field allows you to specify the category of selected files:

  • All – all MS Word files attached to the workflow instance are selected,
  • Dynamic – the category can be created dynamically (using Variables editor) or typed in manually. The category should have the following format: ID#Name or ID,
  • None – files not assigned to any category are selected.

8. Convert

The field allows you to specify which attachments are to be converted to the .docx format. These can be all attachments, only the oldest attachment or only the newest attachment.

9. Regular expression

Search for files to convert based on a regular expression. When creating such an expression, you can use the Creator tool run with a separate button available below this field.

To select right attachments, the regular expression usually needs to follow one of the general formulas presented below:
File1 or File2, example: (criterion1|criterion2)
File1 and not File2, example: ^(criterion1|(?!criterion2))

  • Simple selection of files only with a specific extension, e.g. “.pdf”:
    Correct expression: Attachment1_File.pdf
    Incorrect expression: Attachment1_File.docx

  • All .docx and .pdf files. The extension is checked and the name is skipped:
    Correct expression: Attachment1_FileName007.docx
    Incorrect expression: Attachment1_FileName007.txt

  • The file name starts with a clearly defined word (here: WEBCON) followed by the __ or - symbol, any number of alphanumeric characters, and ends with .docx or .pdf extension:
    Correct expressions: WEBCON_FileName007.docx; WEBCON-FileName007.pdf
    Incorrect expressions: WEBCON FileName with spaces.pdf; SharePoint_FileName123.pdf

  • The file name starts with a date with the following format: “YYYY-MM-DD”, followed by the __ or - symbol, any number of alphanumeric characters, and ends with .docx or .pdf extension:
    Correct expressions: 2015-07-09_FileName007.docx; 2015-07-09-File123_New.pdf
    Incorrect expressions: 2015/07/09-NotGonnaWork.docx; WEBCON_2015-07-09_File.pdf

  • The words in the file name are separated with the - symbol and end with .docx or .pdf extension:
    Correct expressions: WEBCON-File-New.pdf
    Incorrect expressions: WEBCON_File_Old.docx

10. SQL query

The field allows for specifying source files based on an SQL query. The query should return a list of attachment IDs from the "WFDataAttachmets" table.

Select [ATT_ID] from [WFDataAttachmets] where [ATT_Name] = 'file.docx';

11. Document template

The section becomes active after selecting the option From document templates process in the Template field. Two options are available here:

  • Template source – requires a user to specify a data source and the required template,
  • Dynamically calculated – requires the use of a document ID with the following format: /DOCTEMP/GUID/filename.


12. Variables editor

Dynamically generated tree containing all variables that may be used in the current location of Designer Studio. Information on how to use variables in WEBCON BPS, as well as a list of variables can be found in the dedicated section.


The tab allows you to configure the basic parameters of the resulting .docx file.


1. Download after file generation

If a document is not transferred to the attachment after generation, this option is required and results in showing a dialog window that allows for previewing the document or saving it on disk. For documents added as an attachment, this option allows you to preview the added attachment.


The option to preview the generated file on the screen is not available if the action is triggered when the workflow instance is saved or opened in the browser.

2. Save as an attachment

Used to determine whether the generated document is to be added to the workflow instance as an attachment.

In the fields File name and File description enter an SQL query that returns the name or description, respectively, of a file to be generated.

3. Category

Allows you to indicate the category of the saved attachment. In addition to the categories defined in the process configuration by the user, built-in options are available:

  • None – the attachment will be saved without an assigned category,
  • Dynamic – the option allows you to create the category dynamically (using variables from the editor) or enter it manually. The acceptable formats are ID#Name and ID.
    In this mode, it is possible to enter categories from the data source and categories from outside the source. If a category is entered in the ID#Name format, a category with the specified ID must exist in the source. If such a category is not found in the source, the action will end with an error. If a category is entered with the ID alone and a category with such an ID is not found in the category source, the specified phrase will be treated as a category name outside the source.

4. Document language

Allows you to specify the language in which content of a document is generated. The data and numerical values are formatted in accordance with the configured language.
If there are no translations for the configured language, a language used for presentation of untranslated content is the default language in which the configuration was entered. If the option According to application settings is selected, an application configuration language is used as a language in which a document is generated.
Selection of a specific language imposes setting of a language in which a document is generated irrespective of language settings in the application.

5. Update column headers

Once you check this box, the generated document includes respective header translations for data tables and Item lists.


For further information on the action, see the articles: