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

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?

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
    ...
}

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?

I’m facing the same issue with form variables.

I’m trying to fetch the process definition variables using Camunda REST API. I’m using Camunda (camunda-bpm-spring-boot-starter) 3.3.1 embedded in Spring boot application. (Camunda v7.11.0)

I’ve created a dummy process with a Start Event and form variables from different types:

  • Date
  • String
  • Boolean
  • Long
  • Enum

When using the rest API rest/process-definition/key/{processDefinitionId}/form-variables , I’m getting the variables with incorrect types.

{
 "fromDate": {
    "type": "String", // Should be date
    "value": null,
    "valueInfo": {}
  },
  "to": {
    "type": "String", // Should be date
    "value": null,
    "valueInfo": {}
  },
  "renew": {
    "type": "Boolean", // Correct
    "value": null,
    "valueInfo": {}
  },
  "aLongVariable": {
    "type": "Long", // Correct
    "value": null,
    "valueInfo": {}
  },
  "department": {
    "type": "String", // Should be enum
    "value": null,
    "valueInfo": {}
  },
  "issuer": {
    "type": "String",
    "value": null,
    "valueInfo": {}
  }
}