cancel
Showing results for 
Search instead for 
Did you mean: 

[History] get form field names, id, type and values

pprikryl
Champ in-the-making
Champ in-the-making
Hello is it possible to load finished task and its form fields?
I tried to use :

        List<HistoricDetail> details = historyService.createHistoricDetailQuery().taskId(taskId).list();


But i haven't luck with form field name and its type. Is it possible to get these properties from finished tasks? It's important for me. I need to render this form again in report page.
Thank you
PP
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
You can get the ReadOnlyProcessDefinition from RepositoryService (Cast to repositoryServiceImpl and call public ReadOnlyProcessDefinition getDeployedProcessDefinition(String processDefinitionId) {). Some fiddling around in the engine internals, but this is the only way to achieve this.

Then, based on the task-definition key (id in the XML), you can call something like this:


UserTaskActivityBehavior theTaskBehaviour = ((ActivityImpl)readOnlyProcesDefinition.findActivity("task1")).getActivityBehavior();
TaskFormHandler taskFormHandler = theTaskBehaviour.getTaskDefinition().getTaskFormHandler();
      if (taskFormHandler == null) {
        throw new ActivitiException("No taskFormHandler specified for task '" + taskId +"'");
      }
     
      return taskFormHandler.createTaskForm(task);

pprikryl
Champ in-the-making
Champ in-the-making
Ok,
thank you a lot. Should I submit somewhere these post as API feature request?

PP

jbarrez
Star Contributor
Star Contributor
Another way is going through the RepositoryService and retrieve the BpmnModel. That gives you a pojo representation of your process.