cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti 6 UI: Some form variables not displayed

maudrid
Champ on-the-rise
Champ on-the-rise
I have a very simple process consisting of start, script task, user task and end.
They are connected in that order.
On the start, there is a form that takes one input, buzzword.
The script task then adds one additional variable 'myVar' using execution.setVariable().
The user task has a form that displays both buzzword and myVar.
The value of buzzword is displayed correctly but the value of myVar is displayed as '(empty)'.
I have checked the database and the variable for myVar is defined correctly.
I have checked the XHR network requests and the value of myVar is correct in this request:
activiti-app/app/rest/task-forms/12550/variables
result:
[javascript]
[
{"id":"myVar","type":"string","value":"250"},
{"id":"initiator","type":"string","value":"1"},
{"id":"buzzword","type":"string","value":"BPMN"}
]
[/javascript]
However in this request:
activiti-app/app/rest/task-forms/12550
The value is 'null'.
result:
[javascript]
{
   "id": 3001,
   "name": "displayvar",
   "processDefinitionId": "process:2:12528",
   "processDefinitionKey": "process",
   "taskId": "12550",
   "taskName": "show data",
   "taskDefinitionKey": "sid-F26CF113-14E3-42AB-81DA-C15B6B456BF6",
   "fields": [{
      "fieldType": "FormFieldRepresentation",
      "id": "thevalueofbuzzwordis",
      "name": "The Value of Buzzword is",
      "type": "readonly",
      "value": "BPMN",
      "required": false,
      "readOnly": false,
      "overrideId": false,
      "placeholder": null,
      "optionType": null,
      "hasEmptyValue": null,
      "options": null,
      "restUrl": null,
      "restIdProperty": null,
      "restLabelProperty": null,
      "params": {
         "field": "${buzzword}"
      },
      "layout": {
         "row": -1,
         "column": -1,
         "colspan": 1
      },
      "sizeX": 1,
      "sizeY": 1,
      "row": -1,
      "col": -1,
      "visibilityCondition": null
   },
   {
      "fieldType": "FormFieldRepresentation",
      "id": "thevalueofmyvaris",
      "name": "The value of myVar is",
      "type": "readonly",
      "value": null,
      "required": false,
      "readOnly": false,
      "overrideId": false,
      "placeholder": null,
      "optionType": null,
      "hasEmptyValue": null,
      "options": null,
      "restUrl": null,
      "restIdProperty": null,
      "restLabelProperty": null,
      "params": {
         "field": "${myVar}"
      },
      "layout": {
         "row": -1,
         "column": -1,
         "colspan": 1
      },
      "sizeX": 1,
      "sizeY": 1,
      "row": -1,
      "col": -1,
      "visibilityCondition": null
   },
   {
      "fieldType": "FormFieldRepresentation",
      "id": "thisisatest",
      "name": "this is a test",
      "type": "text",
      "value": null,
      "required": false,
      "readOnly": false,
      "overrideId": false,
      "placeholder": "${buzzword} ${myVar}",
      "optionType": null,
      "hasEmptyValue": null,
      "options": null,
      "restUrl": null,
      "restIdProperty": null,
      "restLabelProperty": null,
      "layout": {
         "row": -1,
         "column": -1,
         "colspan": 1
      },
      "sizeX": 1,
      "sizeY": 1,
      "row": -1,
      "col": -1,
      "visibilityCondition": null
   }],
   "outcomes": [],
   "gridsterForm": false
}
[/javascript]
6 REPLIES 6

maudrid
Champ on-the-rise
Champ on-the-rise
Looks like  'activiti-app/app/rest/task-forms/12550' only show values that are in the 'submitted_form' table.

jbarrez
Star Contributor
Star Contributor
The taskform rest request is only returning the definition, not the values. Those are correlated with the variables REST call.

Not sure why it doesn't work. Can you export your app and attach it here so we can have a look?

gelito
Champ in-the-making
Champ in-the-making
I had exactly the same problems which I temporarily solved by setting each variable which I would like to use in the process in start form, even when I don't expect a value to be provided by initiator and I would generate/retrieve the value with some sort of script task. Is it also correct that it is not possible to define data objects for process model like it is done in Activiti Designer (Eclipse)?

maudrid
Champ on-the-rise
Champ on-the-rise
I added the app that you requested.
Just rename to zip

maudrid
Champ on-the-rise
Champ on-the-rise
Bump?

jbarrez
Star Contributor
Star Contributor
Ok, thanks for the app zip. That helps a lot!

The problem is that only the label is defined, but the variables are fetched based on id, not the label.
In the very soon to be released 1.4 version we've fixed this by adding a 'variables' property to the script task. This effectively allows you define variables that are set by these tasks, all the following forms, sequence flow, etc. will pick this up, including the Display Value field.