cancel
Showing results for 
Search instead for 
Did you mean: 

FormService.getTaskFormData return empty FormProperty LIst

campa
Champ in-the-making
Champ in-the-making
I'm trying to retrieve the list of FormProperty of a defined form in process definition, here the part of the code I'm using:
                Task selectMedia = taskService.createTaskQuery().singleResult();      Assert.assertEquals("selectMedia", selectMedia.getName());            TaskFormData selectMediaForm = formService.getTaskFormData(selectMedia.getId());      List<FormProperty> formFields = selectMediaForm.getFormProperties();‍‍‍‍‍‍‍

I obtain the the formFields is always empty, however the task is correct and have e form definition as below:

   <startEvent id="startevent1" name="Start"></startEvent>    <userTask id="selectMedia" name="selectMedia" activiti:candidateGroups="ControlloCrediti.solleciti" activiti:formKey="ControlloCrediti.solleciti">      <extensionElements>        <activiti:formProperty id="media" name="Media" type="string" required="true" readable="false" writable="true"></activiti:formProperty>      </extensionElements>    </userTask>‍‍‍‍‍‍‍

Do you see my error ?
Any Ideas ?
Thx in advance
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
I looked into the form-properties handling code, and saw this:

protected void initializeFormProperties(FormDataImpl formData, ExecutionEntity execution) {
    List<FormProperty> formProperties = new ArrayList<FormProperty>();
    for (FormPropertyHandler formPropertyHandler: formPropertyHandlers) {
      if (formPropertyHandler.isReadable()) {
        FormProperty formProperty = formPropertyHandler.createFormProperty(execution);
        formProperties.add(formProperty);
      }
    }
    formData.setFormProperties(formProperties);
  }

You should set the readable attr your definition to true…

campa
Champ in-the-making
Champ in-the-making
I looked into the form-properties handling code, and saw this:

protected void initializeFormProperties(FormDataImpl formData, ExecutionEntity execution) {
    List<FormProperty> formProperties = new ArrayList<FormProperty>();
    for (FormPropertyHandler formPropertyHandler: formPropertyHandlers) {
      if (formPropertyHandler.isReadable()) {
        FormProperty formProperty = formPropertyHandler.createFormProperty(execution);
        formProperties.add(formProperty);
      }
    }
    formData.setFormProperties(formProperties);
  }

You should set the readable attr your definition to true…

Works !! Thx