RepeatingWordTemplateHandler

Description

The ActionHandler RepeatingWordTemplateHandler makes it possible to create a Word document for several process variables. It is an extension of the WordTemplateHandler. The process variables must be indexed using a number in square brackets (i.e. Variable[0], Variable[1], Variable[3]…). Then, each ${Variable} entry is replaced by one of the indexed variables. A new template is created for each index. It is also possible to merge all the created documents.


Class

com.dooris.bpm.actionhandler.RepeatingWordTemplateHandler

Parameter

Parameter 

Default value

Description

Valid examples

Parameter 

Default value

Description

Valid examples

template

 

This parameter is used to set the path to the template, so the actionhandler can search for it in the resources folder.

In order to access ‘Resources’ section under the 'Administration' please see: Roles

/WordTemplate/dokument.docx

repeat

 

This parameter should be set to true in order to execute this actionhandler.

true

mergeDocumentName

 

This parameter is used to set the name for the merged documents.

Dokument

merge

false

This parameter is used to decide if the documents should be merged. All documents will be merged into one if this parameter is set to true.

true

repeatCounter

 

The repeatCounter is used to track the number of times a certain operation or action needs to be repeated. 
This allows the template to be executed multiple times based on a specific count by replacing each ${Variable} with the indexed one "Variable[0],...,Variable[n]" in the template and create new document for each index.

counter

pdf

 

It can be either true or false. If the template should be converted into PDFs the value must be set to true.

true

 

 

Example:

In the following, the use of the ActionHandler is briefly explained.

  1. the ActionHandler is set up in the "Generate invoice", node leave event in the process model.

Screenshot 2024-08-26 091835.png

 

 

The following parameters were used in this example:

Parameter 

Description

Valid examples

Parameter 

Description

Valid examples

template

Name of the word template that will be uploaded to the resources folder is set here.

repeat_template.docx

repeat

Here, true must be entered otherwise actionhandler won’t be executed.

true

repeatCounter

For example we will set the counter to 3, and it will generate 3 documents out of it + if merge is true will create an aditional document which is a merge of all three documents in one place.

${counter}

pdf

By setting to true will create pdf documents out of template.

true

merge

By setting to true it will create a merged document

true

mergeDocument

The name of the merged document will be set MergeDocument

MergeDocument

target

With the target parameter, the user can determine the document name in the destination folder.

_Target

 

  1. Word template is required (detailed explanation on how to create the template is provided in the WordTemplateHandler) . In the template document the variables ${invoiceto}, ${deliverto} ${amount} etc. are used.

This template should be uploaded in Administration → Resources.

Screenshot 2024-08-25 212646.png
  1. Inside the process model the form is setted up with six input fields using the indexed variables: invoiceto[0], deliverto[0], amount[0], description[0], individualprice[0], total[0] to match the parameters used in the handler

    Invoiceto[0]

deliverto[0]

amount[0]

description[0]


individualprice[0]


total[0]


For the second document that will be generated out of template, the process variables must have the same name as the previous one but indexes start with 1. eg. invoiceto[1], deliveryto[1], amount[1], description[1], individualprice[1], total[1].

invoiceto[1]

When starting the process, the fields must be filled in the Form.

 

 

 

After a successful execution you can see that three documents are visible in the "Documents" tab of the operation. The first document contains the value from process variables having Index number [0] like invoiceto[0], description[0] etc. The second document contains the value from process variables having Index number [1] like invoiceto[1], description[1] etc. The merged version of these two documents is also available.

 

You can view the content of the first two documents here. The third document is simply a merged version of the first two.


First document:

Second document:

Merged documents: