AnsweredAssumed Answered

Variables in a sub process

Question asked by walterjs on Jul 7, 2011
Latest reply on Aug 6, 2015 by yogesh1454
I have a simple approval sub process that can have multiple instances created at a time. I want to use the result of the approval in the parent process. As soon as anybody rejects, all other instances are destroyed and the process is rejected. Basically it needs 100% approval by everybody. This all works fine, except that I have to create a service task just before the end event in the sub process with the following expression to get the variable to the parent process:
${'reject'.equals(execution.getProcessInstance().getVariable('decision')) ? execution.getId() : execution.getProcessInstance().setVariable('decision', decision)}

I only want to write the decision back to the parent if it has not been rejected already, hence the condition in the expression.

If I do not do this, the parent process knows nothing about the "decision" variable. Is there another way of getting the sub-process variables to the parent process like with a call activity?

Also, does anybody have a cleaner way of doing this expression?