Search code examples
jbpmkie-workbench

How to pass variables from a sub-process into the process that contains it? (jbpm)


If I have a process that defines three sub-processes, with one sub-process that is linked to an XOR gateway, and the other two sub-processes conditionally linked to the XOR, how can I make variables available from within the first sub-process to conditional expressions in the sequence flows that emerge from the XOR gateway?

I've been toying around in KIE Workbench and found that, while viewing the first sub-process properties in the context of the greater process, there is an output variable, which we have mapped to a model that we defined some of the properties of from within the sub-process.

So I'm wondering: - should the variables we defined in the model from within the sub-process still be available outside of the sub-process in the form of the output variable we defined? - if not, are globals a viable solution to this problem?


Solution

  • I managed to do this recently.

    We produced a model variable within one of the user tasks which we passed out of the user task into the sub-process scope. Then when we were in the parent process view we defined an output on the sub-process task, and mapped it to a parent process level variable.

    The step that I was missing, and what was causing the exception, was that I had created a parent process level variable but I wasn't mapping the sub-process task output to the parent process variable.