4.7. Form Modeler
- Form Modeling WYSIWYG UI for forms
- Form autogeneration from data model / Java objects
- Data binding for Java objects
- Formula and expressions
- Customized forms layouts
- Forms embedding

Figure 4.8. Adding fields by origin

Figure 4.9. Adding classes from data model
4.7.1. Creating a Form in Form Modeler
- In Business Central, go to → .
- On the perspective menu, select → .
- In the dialog that opens, fill out the name of your form in and click .
button to place the field types onto the canvas, where you can modify them. To modify the field types, use the icons that display when you place the cursor over a field: , , , , , or . The icons enable you to change the order of the fields in the form, group the fields, or clear and edit their content.

Figure 4.10. New form
4.7.2. Opening an Existing Form in Form Modeler

Figure 4.11. Opening an Existing Form
4.7.3. Setting Properties of a Form Field in Form Modeler
- In Form Modeler, select the tab and click the arrow
button to the right of a field type. The field type is added to the canvas.
- On the canvas, place the cursor on the field and click the edit
icon.
- In the dialog that opens on the right, set the form field properties and click at the bottom of the dialog for HTML Labels. For other form field properties, the properties change once you have removed focus from the property that you are modifying.
4.7.4. Configuring a Process in Form Modeler
- Create process variables to hold values entered into forms. Variables can be simple (e.g. 'string') or complex. You can define complex variables using Data Modeler, or create them in any Java integrated development environment (Java IDE) as regular plain Java objects.
- Declare the process variables in the 'variables definition' property.
- Determine which variables you want to set as input parameters for the task, which shall receive response from the form, and establish mappings by setting the 'DataInputSet', 'DataOutputSet', and 'Assignments' properties for any human task. To do so, use the Editor for Data Input, Editor for Data Output, and Editor for Data Assignment.
Example 4.1. Defining a Variable using Data Modeler

4.7.5. Generating Forms from Task Definitions

Figure 4.12. Generating Forms Automatically
) located above a user task.

Figure 4.13.
formName-taskform in the same package as the process, the human task engine will use the form to display and capture information entered by the user. If you create a form named ProcessId-task, the application will use it as the initial form when starting the process.
4.7.6. Editing Forms
move fields, add new fields, configure fields, or set values for object properties.
4.7.7. Moving a Field in Form Modeler

Figure 4.14. Moving a Form Field in Form Modeler

Figure 4.15. Destination Areas to Move a Field
4.7.8. Adding New Fields to a Form

Figure 4.16. Adding Fields by Origin
Input binding expression and Output binding expression properties, so when the form is submitted, the values in the fields are stored in the corresponding data origin. The tab allows you to add fields to the form from the fields type palette of the Form Modeler. The fields do not store their value for any data origin until they have correct configuration of the Input binding expression and Output binding expression properties.

Figure 4.17. Adding Fields by Type
simple types are used to represent simple properties like texts, numeric values, or dates. The following table presents a complete list of supported simple field types:
Table 4.1. Simple Field Types
| Name | Description | Java Type | Default on generated forms |
|---|---|---|---|
| Short Text | Simple input to enter short texts. | java.lang.String | yes |
| Long Text | Text area to enter long text. | java.lang.String | no |
| Rich Text | HTML Editor to enter formatted texts. | java.lang.Srowing | no |
| Simple input to enter short text with email pattern. | java.lang.String | no | |
| Float | Input to enter short decimals. | java.lang.Float | yes |
| Decimal | Input to enter number with decimals. | java.lang.Double | yes |
| BigDecimal | Input to enter big decimal numbers. | java.math.BigDecimal | yes |
| BigInteger | Input to enter big integers. | java.math.BigInteger | yes |
| Short | Input to enter short integers. | java.lang.Short | yes |
| Integer | Input to enter integers. | java.lang.Integer | yes |
| Long Integer | Input to enter long integers. | java.lang.Long | yes |
| Checkbox | Checkbox to enter true/false values. | java.lang.Boolean | yes |
| Timestamp | Input to enter date and time values. | java.util.Date | yes |
| Short Date | Input to enter date values. | java.util.Date | no |
| Document | Allows the user to upload documents to the form. | org.jbpm.document.Document | No |
Complex field types are designed for work with properties that are not basic types but Java objects. To use these field types, it is necessary to create extra forms in order to display and write values to the specified Java objects.
Table 4.2. Complex Field Types
| Name | Description | Java Type | Default on generated forms |
|---|---|---|---|
| Simple subform | Renders the form; it is used to deal with 1:1 relationships. | java.lang.Object | yes |
| Multiple subform | This field type is used for 1:N relationships. It allows the user to create, edit, and delete a set child Objects.Text area to enter long text. | java.util.List | yes |
Decorators are a kind of field types that does not store data in the object displayed in the form. You can use them for decorative purposes.
Table 4.3. Decorators
| Name | Description |
|---|---|
| HTML label | Allows the user to create HTML code that will be rendered in the form. |
| Separator | Renders an HTML separator. |
4.7.9. Configuring Fields of a Form
Field Type- can change the field type to other compatible field types.Field Name- is used as an identifier in calculating of formulas.Label- the text that is displayed as a field label.Error Message- a message displayed when there is a problem with a field, for example in validation.Label CCS Class- allows you to enter a class css to apply in label visualization.Label CCS Style- allows you to directly enter the style to be applied to the label.Help Text- introduced text displayed as an alternative attribute to help the user in data introduction.Style Class- allows you to enter a class CSS to be applied in field visualization.CSS Style- allows you to directly enter the style to be applied to the label.Read Only- a field with this property allows reading only, no write access.Input Binding Expression- defines the link between the field and the process task input variable. In runtime, it is used to set the field value to the task input variable data.Output Binding Expression- defines the link between the field and the process task output variable. In runtime, it is used to set the task output variable.
4.7.10. Creating Subforms with Simple and Complex Field Types
Procedure 4.2. To create and insert a subform containing a single object inside a parent form:
- In Business Central, go to → .
- On the perspective menu, select → .A new form opens in the Form Modeler. You must now configure the new form with information of the object it must contain.
- Enter the values for the required fields in the Form data origin tab and click .

Figure 4.18. Create Subform
- Click Add fields by origin tab and add the listed fields to the form.

Figure 4.19. Add fields by origin
- Click the Edit icon on the field in the form to open the Properties tab.
- In the Properties tab, configure the form by providing required values to the fields and click to save the subform.
- Open the parent form to configure the properties of the object.
- In the parent form, click the Add fields by type tab. Select the object on the form and configure it in the Properties tab.
- In the Properties tab, select Simple subform for the Field type property. Then select the newly created subform for the Default form field property.

Figure 4.20. Configure the Parent Form
- Click to save the parent form.This inserts your subform containing a single Java object inside the parent form.
Procedure 4.3. To insert a subform with multiple objects inside a parent form:
- In Business Central, go to → .
- On the perspective menu, select → .A new form opens in the Form Modeler. You must now configure the new form with information on the object array it must contain.
- Enter the values for the required fields in the Form data origin tab and click .
- Click Add fields by origin tab and add the listed fields to the form.
- Click the Edit icon on the field in the form to open the Properties tab.
- In the Properties tab, configure the form by providing required values to the fields. You can use the Formula Engine to automatically calculate field values.
- Click to save the subform.
- Open the parent form to configure the properties of each of the objects.
- In the parent form, click the Add fields by type tab. Select each object on the form one by one and configure them in the Properties tab.
- In the Properties tab, select Multiple subform for the Field type property. Then select the newly created subform for the Default form field property.

Figure 4.21. Configure the Parent Form
- Click to save the parent form.This inserts your subform containing an array of Java objects inside the parent form.
4.7.11. Attaching Documents to a Form
Document form field. This field can be attached to any form, process or task based.
Document field to a form, click on it while creating or editing an existing form (in the Add fields by type section).

Document form fields based on the presence of a org.jbpm.document.Document variable type in your process.


Pluggable Variable Persistence
<marshalling-strategy> element. This element should name a type that provides an implementation of the org.kie.api.marshalling interface.
public boolean accept(Object object): Determines if the given object can be marshalled by the strategy.byte[] marshal( Context context, ObjectOutputStream os, Object object ): Marshals the given object and returns the marshalled object as byte[].Object unmarshal( Context context, ObjectInputStream is, byte[] object, ClassLoader classloader ): Reads the object received as byte[] and returns the unmarshalled objectvoid write(ObjectOutputStream os, Object object): same asmarshalmethod, provided for backwards compatibility.Object read(ObjectInputStream os): same asunmarshal, provided for backwards compatibility.
docs. This default implementation is defined by the DocumentStorageService class and is implemented through the DocumentStorageServiceImpl class.
4.7.12. Rendering Forms for External Use
4.7.12.1. JavaScript Library for Form Reuse
Blueprint for using the JavaScript Library
- Integrate the JavaScript library in the codebase for the external client application so that its functions are available.
- Create a new instance of the
jBPMFormsAPIclass in your own JavaScript code. This is the starting point for all interactions with this library.var jbpmRestAPI = new jBPMFormsAPI();
- Call your desired methods on this instance. For example, if you want to show a form, you would use the following method:
jbpmRestAPI.showStartProcessForm(hostUrl, deploymentId, processId, divId, onsuccess, onerror);
and provide the relevant details (hostUrl, deploymentId, processId and so on. A full list of the methods and parameters follows after this section). - Do post processing with the optional
onsuccessandonerrormethods. - Work with the form, starting processes (
startProcess()), claiming tasks (claimTask()) starting tasks (startTask()) or completing tasks (completeTask). Full list of available methods follows after this section. - Once you're finished with the form, clear the container that displayed it using
clearContainer()method.
Full list of available methods in the JavaScript Library
showStartProcessForm(hostUrl, deploymentId, processId, divId, onsuccessCallback, onerrorCallback):Makes a call to the REST endpoint to obtain the form URL. If it receives a valid response, it embeds the process start form in the stated div. You need these parameters:hostURL: The URL of the Business Central instance that holds the deployments.deploymentId: The deployment identifier that contains the process to run.processId: The identifier of the process to run.divId: The identifier of the div that has to contain the form.onsuccessCallback(optional): A JavaScript function executed if the form is going to be rendered. This function will receive the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to render the form. This function will receive the server response as a parameter.
startProcess(divId, onsuccessCallback, onerrorCallback):Submits the form loaded on the stated div and starts the process. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the process is started. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to start the process. This function receives the server response as a parameter.
showTaskForm(hostUrl, taskId, divId, onsuccessCallback, onerrorCallback):Makes a call to the REST endpoint to obtain the form URL. If it receives a valid response, it embeds the task form in the stated div. You need these parameters:hostURL: The URL of the Business Central instance that holds the deployments.taskId: The identifier of the task to show the form.divId: The identifier of the div that has to contain the form.onsuccessCallback(optional): A JavaScript function executed if the form is going to be rendered. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to render the form. This function receives the server response as a parameter.
claimTask(divId, onsuccessCallback, onerrorCallback):Claims the task whose form is being rendered. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the task is claimed. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to claim the task. This function receives the server response as a parameter.
startTask(divId, onsuccessCallback, onerrorCallback):Starts the task whose form is being rendered. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the task is claimed. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to claim the task. This function receives the server response as a parameter.
releaseTask(divId, onsuccessCallback, onerrorCallback):Releases the task whose form is being rendered. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the task is claimed. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to claim the task. This function receives the server response as a parameter.
saveTask(divId, onsuccessCallback, onerrorCallback):Submits the form and saves the state of the task whose form is being rendered. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the task is claimed. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to claim the task. This function receives the server response as a parameter.
completeTask(divId, onsuccessCallback, onerrorCallback):Submits the form and completes task whose form is being rendered. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the task is claimed. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to claim the task. This function receives the server response as a parameter.
clearContainer(divId):Cleans the div content and the related data stored on the component. You need these parameters:divId: The identifier of the div that contains the form.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.