Variable scope in camunda 8 subprocess

Hi,

I have subprocess and error end event where I am defining the output variable but not propagating the subprocess variable to parent process scope after the completion of subprocess.

Can anyone assist on this as I have to do next activity based subprocess result?

TIA.

“Output” is not relative to the subprocess, but to the step itself.
Create a new script task to assign the variable between the exclusive gateway and the Error-End event.

You should then be able to see the variable being created on the Tasklist / Operate for this subprocess. You can rename the variable in the calling process using the “Output” section of the Call Activity.

Thanks for putting your thoughts on this but I don’t think so. Since I can see all the output variables of previous steps to parent process but only not able to see the error-end event output variable.

Though I haven’t used any data mapping/script task.

it will be better if you shared some example on ths.

TIA.

That’s because they have been made into process variables in the subprocess, and got mapped back to the parent process.
You can’t add a process variable to a process that has ended (Error End Event should DISALLOW adding Output mapping)
Have a good read of Variables | Camunda 8 Docs

I can understand your concern. I was followed the camunda docs and understood the variable scopes but there was no clarification for Error End Event or adding the variables to the end event is not allowed so, it seems some explanation was missed in docs.

And I was following the concept of adding the variables in the property “Output” will be in process variable scope.

TIA.

Again, Output isn’t really for creating variables, more for mapping the variable that is created in that step to a name within the process.

3 Likes

Thanks @GotnOGuts. I got it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.