Reputation: 341
Is there any way to explicitly get the values of a user tasks form field? I have a form field with three enum values.
When I do the REST call /task/{id}/form-variables
I get following output:
{
"pruefungOk": {
"type": "String",
"value": null,
"valueInfo": {}
}
}
But what i would like to have is something like:
{
"pruefungOk": {
"type": "String",
"value": null,
"valueInfo": {},
"availableValues": ["ok", "notOk", "helloTest"] <-- Array of the values from first picture
}
}
Is that somehow possible without doing workaround and dirty code? And why isnt there a REST Call for that?
Upvotes: 2
Views: 3660
Reputation: 825
I know it's a little late, but maybe you will use it some other time or it will be help for some other. What I did is the following:
TaskFormData taskFormData = ProcessEngines.getDefaultProcessEngine().getFormService().getTaskFormData(taskId);
And after that to get the values:
taskFormData.getFormFields()
.forEach(formField -> {
if (formField.getType() instanceof EnumFormType) {
((EnumFormType) (formField.getType())).getValues().forEach((key, value) -> {
System.out.println("This is the key:" + key);
System.out.println("This is the value:" + value);
});
}
});
Upvotes: 1
Reputation: 7583
Does https://docs.camunda.org/manual/7.13/reference/rest/task/get-rendered-form/ help? I know it is not perfect, but should contain the options.
To extract static information from the bpmn file you can also always resort to https://docs.camunda.org/manual/7.13/reference/rest/process-definition/get-xml/ and then apply e.g. jQuery to the bpmn20Xml in the response.
Upvotes: 0
Reputation: 1443
Please have a look at https://forum.camunda.org/t/how-to-get-form-field-properties-using-rest-api/5981. Looks like the same use case.
Upvotes: 0