UserTask don't add form value to ExtensionElement

#1

Hello,

I’m generating a process, with tasks, with the org.flowable.bpmn.model.
I can create the process, tasks and transitions. And instantiate it with success.
No I’m trying to create a form, and associate it to a task.

I got something like this:

    UserTask userTask = new UserTask();
    userTask.setName("my task name"));
  userTask.setId("IDTask123");

       FormProperty formProperty = new FormProperty();

        ExtensionElement extensionElement = new ExtensionElement();
        formProperty.setName("task value");
        formProperty.setId("taskType");
        extensionElement.setName("new name of the form");
        extensionElement.setValues(formProperty);
        userTask.addExtensionElement(extensionElement);

But when I inspect the usertask attributes the extensionElement are missing… So, no form is being added…

Any help?

Thanks in advance,
Filipe

#2

Well, it was my mistake. Solve it replacing the ExtensionElement method by the following:

       FormProperty formProperty = new FormProperty();
        formProperty.setName("Valor do form");
        formProperty.setId("taskTypeNew1");
        formProperty.setType("long");

         ArrayList<FormProperty> formProperties = new ArrayList<>();
        formProperties.add(formProperty);
        userTask.setFormProperties(formProperties);