What if I have a String context variable named "str" with value "start" in start-state, and modify it in "state one" and "state two", str="one" and str="two" respectively.

What will be the value at the end after the join?

Will the "fork" make replicas of context variables when doing the fork, so that global values will not be overloaded in "state one" nor in "state two" in the same time? I guess, making replicas is necessary, because a variable modified in "state one" cannot be seen in "state two", since the later may also modify (and thus it would overload) the value of same variable. If so, how will "join" merge these variable replicas? What will be the final context variable value?

afaik, states do not have 'local' variables, so once you update it in state one, state two also has access to them. Only when using tasks you get automatic local copies of the values from the time the task is created. Each task completed updates the global variable, so the last task completed is the one that 'wins'. A fork and join do not influence this at all

"kukeltje" wrote:Each task completed updates the global variable, so the last task completed is the one that 'wins'.

This means there will be a data-loss. E.g. A modifies its local replica of a global context variable, and B modifies also its replica. But if B approves later, modifications of A will be lost, only B's local replica will be stored back globally.

Correct, and whether it is dataloss is debatable (the behaviour is by design). The data A modified is still present in that finished task.

If you want/prefere other behaviour, you can discuss that in the design forum, but keep in mind... it is a real complex issue that often has it's roots in an not well designed process. Meaning, if you can prevent parallel tasks modifying the same date you should

use the api to get a list of all tasks of that user. Finished tasks are also in there. Not sure if you can retrieve jsut tasks for this processinstance. I think you can. Then you have access to the variables. Play a little with the api and learn it....