Fading Coder

One Final Commit for the Last Sprint

Home > Tools > Content

Storing Form Data in Flowable 6.8 Processes

Tools 2

Why Forms Are Used

Forms serve as a mechanism to capture and store business-related data within workflow processes. They allow for dynamic data collection at runtime, which can be accessed and modified throughout the process lifecycle. Additionally, forms support conditional expressions and provide a structured way to present user input.

Form Implementation Language

In this project, forms are implemented using React. The form elements are defined by developers through a dedicated form designer module, where properties such as size, visibility, default values, and disabled states can be configured.

Each element within a form has a unique identifier known as a 'key'. These keys are crucial because they map directly to variables stored during process initiation, enabling access to form data at any point in the workflow.

Process Initiation and Form Handling

During process creation, the designed form is rendered for users to complete. Each form field corresponds to a key-value pair, where the key represents the field identifier and the value holds the submitted data.

The backend receives these form submissions as a Map<String, Object>, which is then passed to the Flowable engine via:

runtimeService.startProcessInstanceById(procDef.getId(), variables);

This call initiates the process instance while injecting the collected form data into the process variables. These variables are not only used to persist form values but also to replace placeholders in BPMN definitions.

For example, if a form includes an approver field with a matching key in the BPMN XML, the selected user ID will automatically populate the placeholder during process start.

Data Storage After Process Start

Once a process begins, all associated form data and variables are persisted in the act_ru_variable table. This table stores:

  • TYPE_: The data type of the variable
  • NAME_: The variable name (i.e., the form field key)
  • TEXT_: The actual value stored

To retrieve all variables for a specific process instance, you can query based on PROC_INST_ID_. Alternatively, when implementing ExecutionListener, the execution context provides access to all process variables:

Map<String, Object> variables = execution.getVariables();
Object value = execution.getVariable("fieldKey");
String processInstanceId = execution.getProcessInstanceId();
execution.setVariable("fieldKey", value);

These APIs facilitate dynamic interaction with process variables during execution.

Tags: flowablebpmn

Related Articles

Efficient Usage of HTTP Client in IntelliJ IDEA

IntelliJ IDEA incorporates a versatile HTTP client tool, enabling developres to interact with RESTful services and APIs effectively with in the editor. This functionality streamlines workflows, replac...

Installing CocoaPods on macOS Catalina (10.15) Using a User-Managed Ruby

System Ruby on macOS 10.15 frequently fails to build native gems required by CocoaPods (for example, ffi), leading to errors like: ERROR: Failed to build gem native extension checking for ffi.h... no...

Resolve PhpStorm "Interpreter is not specified or invalid" on WAMP (Windows)

Symptom PhpStorm displays: "Interpreter is not specified or invalid. Press ‘Fix’ to edit your project configuration." This occurs when the IDE cannot locate a valid PHP CLI executable or when the debu...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.