User Task Form Field - Enum - form-variable REST API does not return enum data


#1

Using the Camunda Modeler, we have created a simple workflow with a user task. In the modeler, we defined a Form under the Forms tab and assigned the Form Type = Form Data. Then we defined one form field, with a type of enum. We defined two Values for this field, with the Names “Mom” and “Dad”.

We start an instance of this process, and then use this REST API call to get the form variables: engine-rest/task/bd8da021-fc40-11e5-8559-0242ac110006/form-variables.

This call does not return the possible enum values, nor does it indicate that this is an enum field. It returns the following:
{
“FormField_ChosenParent”: {
“type”: “String”,
“value”: “Value_Mom”,
“valueInfo”: {}
}
}

We need to get access to the possible enum values so that we can properly display these choices in a form. How can we do this?


#2

If you are using Java you can get them with the next code

String processXML = ... // engine-rest/process-definition/your-process/xml
BpmnModelInstance model = Bpmn.readModelFromStream(IOUtils.toInputStream(processXML));
UserTask userTask = model.getModelElementById(bean.getTaskDefinitionKey());
ExtensionElements ee = userTask.getExtensionElements();
CamundaFormData formData = ee.getElementsQuery().filterByType(CamundaFormData.class).singleResult();
for (CamundaFormField formField : formData.getCamundaFormFields()) {
    Collection<CamundaValues> values = formField.getCamundaValues(); // Here is where the values are
    ...
}

#3

Writing a lot of code to get the enum values out of the data is maybe possible either via XML on progress-definition or from the rendered-form on task. But the question was: can it be in the JSON of the REST API of the Task endpoint? And I would add another requirement: also include the validation rules and constraints in some uniform way. We also use the REST API to fetch open tasks from running processes of users. We then use the data to present interfaces to the user to finish the tasks. We want to built our own interface and forms, not use the forms from Camunda. Therefor we need the structured data of processes and tasks. Getting the enum values of enum-variables and getting the constraints and validation rules of the variables would be really appreciated! Can anyone please pick this up as a feature request?