Variable merging logic

Hi everyone.

In tasklist, I want to show details about snapshot of process start (using my ‘start-form.html’).
At ‘start-form.html’, It has a <select> option variable, and it has value of A,B,C. (default show value is ‘A’)

After process starting, other variables show own correct value. But only <select> option variable always shows ‘A’. (If I set default value=‘null’, It shows correct value.)

Look at this following code. (camunda-form.js / CamundaForm.prototype.mergeVariables)

for (var v in variables) {
    if (vars[v]) {
      for (var p in variables[v]) {
        vars[v][p] = vars[v][p] || variables[v][p];
    else {
      vars[v] = variables[v];

‘vars’ means script value and ‘variables’ means values from DB.
Because of following line, variable always shows ‘A’.

vars[v][p] = vars[v][p] || variables[v][p];

But I think

vars[v] = variables[v];

this line is enough to merge variables.
Or, this following line is more suitable. isn’t it?

vars[v][p] = variables[v][p] || vars[v][p];

how do you think?

thank you.

Hi SungJoon Ban,

I think no issue with the code as script variables should take precedence over db variables (original server values).
but there is an issue with the select box. please see below post

If form values take precedence over DB variable values, let’s think about this…
Given a process with two sequential user tasks (T1 and T2),
if some form linked to both tasks has a text field of which value is 100
and some user changes the value of that field into 200 and complete that task,
then the next user gets T2 task and the value of that field will be shown as 100.
If the former user changed some value expecting the changed value will be shown at the next task,
is this situation reasonable ?
Is this only a form-developing issue ?