cancel
Showing results for 
Search instead for 
Did you mean: 

Get variable of subprocess

checco
Champ in-the-making
Champ in-the-making
Hi to all,
I have a subprocess that is reused in other processes and the subprocess can end with or without error. In the case of error the subprocess terminates with a ErrorEndEvent in the other case the subprocess terminates with a  normal EndEvent.
In the processes that uses the subprocess I have put a CallActivity task with a outgoing SequenceFlow and a ErrorBoundaryEvent attached, moreover in the main config of the CallActivity I have defined an outgoing parameters mapping that has as its source a subprocess variable and as its target a process variable.

In the situation just described there are two different behaviors if the subprocess terminates with or without error:
  • Without error: the process CAN access to the variable setted by outgoing parameters mapping

  • With error: the process CAN NOT access to the varibale setted by outgoing parameters mapping because it isn't defined
My problem is that the subprocess sets several variable that are used to handle the error in the process, but I can access to those variables only if the subprocess terminates without error!
Is the intended behavior? How can I access to the varibale of the subprocess from the process?

Thanks,
Francesco.
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

based on the descriptions in the Activiti User Guide (e.g. [url=http://activiti.org/userguide/#bpmnCallActivity}CallActivitiand Event Sub-Process), I think this is intentional and correct behavior. Since the sub-process fails, no data is transferred, as it is defined that data is "copied back into the main process when it ends." Termination by error is not the same as a proper end.
If the error is a proper way the sub-process could end, it should be handled as such within the sub-process. That way, data could be copied back by the CallActivity. Otherwise, the only option I see would be in passing the relevant data back via the error of the sub-process, which would have to be an explicitly generated error in order for you to define its data payload. This I would consider to be the less optimal of both options.

Regards
Axel

checco
Champ in-the-making
Champ in-the-making
Thank's Axel,
I agree with you, but for my situation i think that the second option is the suitable solution because my subprocess is a short process that it is used by other processes only for integrate alfresco with an external application of electronic signature. So the main process has different behavior if the subprocess ends normally rather then ends with a high level application error of the external application, in latter case i would be able to pass the external application error to the super process in order to manage the error in different manner for each super process.

You have talk about error's data payload, can you explain to me how to use it or point me to the right documentation? because in the examples provided by activiti (http://activiti.org/userguide/#examples) I have not found any similar situation and with the activiti eclipse designer (http://activiti.org/userguide/#activitiDesigner) i can't found a way to define the error's data payload.

Thank you very much,
Francesco.