Why does a commit doesn't store updated variables?

Hi,

I’ve the following process definition which manipulates a JSON object and then prints the manipulated value before and after a user task. I’m not sure, if this is an issue or if this is the expected behavior!? But after the user task the value which is printed is the unmodified(original) value whereas the value which is printed before the user task is the modified value. I know that the user task commits the transaction because the user task is a wait state. But what I do not understand is, why the manipulated value is not committed to the database?

Task: Create JSON

S(JSON.stringify({"value": 1}));

Task: Manipulate JSON

data.prop("value", 2)

Task: Show JSON before UserTask

data.prop("value")

Task: Show JSON afterUserTask

data.prop("value")

If I override the variable in the task which manipulates the value, then all works as expected and the printed values are the same. But if I only modify the referenced variable, then the printed values are not the same.

Cheers,
Christian

Hi @christian.kaps,

Implicit variable updates (i.e. without calling a #setVariable method) only work for variables of type object (see the docs for a list of all types). Even for those, we recommend to use explicit updates wherever possible since implicit updates have certain limitations.

Cheers,
Thorben

1 Like

Hi @thorben,

thanks for your explanation! It would be nice if this limitations would be documented, because I think this is really error prone. I’ve seen that already an open issue exists. Would be nice if this gets fixed :wink:

Anyway, thanks for your prompt help in the last days. Great work!

Best regards,
Christian