Form properties for historic user tasks

Hi!

We are using Flowable with Spring Boot (7.0.0), making use of the legacy form properties on user task activities. We are aware that using Forms rather than form properties is the recommended approach in the current version of Flowable, but migration is not faesible at this moment.

What we would like to do is obtain the form properties for a user task that has been completed. For an active user task, the form properties can be obtained as follows:

val formProperties = formService.getTaskFormData(taskId).formProperties

However, once the user task has been completed, this approach is no longer possible as the task cannot be found, presumably because it’s looking in the runtime tables.

I’ve been trying to find a way to achieve this, for example via the HistoryService, with no success. Furthermore, I can’t see form properties persisted in any of the database tables and suspect that they may be read from the BPMN definitions.

I have a few questions on the above points:

  • Are form properties persisted in the database, or read from the process definition?
  • Is it possible / how can I obtain the form properties for a completed user task?
  • How does getTaskFormData obtain the proeprties? Can I use a similar approach for historic tasks somehow?
  • Could the FormEngine be of any help here, or is that only relevant for the newer form approach?

Any pointers and insight would appreciated. Thanks in advance!

Hi,

I’ve seen that formService resolves the formProperties on runtime when you call to getTaskFormData, and the task has to be active.

I’ve resolved a similar problem by setting the form properties as a task’s local variable when the task is created (using event listener)

FlowableEntityEvent eventImpl = (FlowableEntityEvent)event;
TaskEntity taskEntity = (TaskEntity)eventImpl.getEntity();
Map<String, Object> properties = formService.getTaskFormData(taskEntity.getId()).getFormProperties().stream().collect(Collectors.toMap(FormProperty::getId, FormProperty::getValue));
taskEntity.setVariableLocal("theProperties", properties);

I set all the properties as a Map, but you can store them separatelly in order to you can use them in variables queries.

I hope I was able to help you.

I have also been looking into using task local variables to solve this, and it’s reassuring to hear your experience of using the same approach.

I was doing this upon task completion as part of some existing custom logic, but I like your idea of using the task creation event.

Thanks for your response, I appreciate it!