5.2. Process Forms

ProcForm Interface

When you declare user task outcomes or the start event node in the model editor, it is possible to set a form that will be displayed to the user. The form class should implement the ProcForm interface.

The methods of the ProcForm interface:

  • getComment(): String - returns the value that will be written to the comment field of the ProcTask object or to the startComment field of ProcInstance if the form is displayed on a process start.

  • getFormResult(): Map<String, Object> - returns a list of objects that will be added to process variables after the form commit.

A List of Forms for a Process Model Designer

A list of forms available in the process model designer is built according to the configuration files that are defined in the bpm.formsConfig application property. To add a new process form, do the following:

  1. Create and register a screen for the form. Screen controller must implement the ProcForm interface.

  2. Create an XML file, e.g. app-bpm-forms.xml, which will contain a description of custom forms, and place it under the src directory of the web or gui module. For example:

    <?xml version="1.0" encoding="UTF-8"?>
    <forms xmlns="http://schemas.haulmont.com/cuba/bpm-forms.xsd">
        <form name="myCustomForm" default="true">
            <param name="someParam" value="hello"/>
            <param name="otherParam"/>
        </form>
    </forms>

    myCustomForm here is a screen id.

    The above configuration also describes available form parameters with their names and default values.

    A form with the default="true" attribute will be used as the default form in the model.

  3. Override the bpm.formsConfig property in the web-app.properties file.

    bpm.formsConfig = bpm-forms.xml app-bpm-forms.xml