How to call one process from Other Process?

Hi All,
I have executed the sub process examples. But i have one question,
Can I call one process from other process?.( i have two processes A.bpmn20.xml and B.bpmn20.xml.can i call process B from Process A?.)

If yes , please reply on this.

Regards,
Subbu

1 Like

Hi,

I am able to achieve this by using call activity.

Regards,
Subbu

Call activity can work if it matches your requirements.
For example, you cannot close the parent process and keep the child process running, if you use it.
We had this requirement and you can still implement it without the call activity.
We used a script task that calls the engine API to start a new process by message, passing the required process variables as parameters.

1 Like

ya we can implement that way. But call activity is providing same feature with out code right?

Call Activity is not providing exactly the same feature.
The difference is that the process instance created by the call activity cannot be open while the calling process is closed and the calling flow cannot continue until the called process is still open.
The call activity is not asynchronous.

Hi @maudrid

I am also looking for this solution. Can you please share an example for this.

Thanks,
Manjunath

I’m using a script activity with language javascript

var Logger = Java.type('org.slf4j.LoggerFactory');
var log = Logger.getLogger('myTest');

var HashMap = Java.type('java.util.HashMap');
var variables = new HashMap();
variables.put('test', 'value');

// You can forget about trying to use try..catch here. startProcessInstanceByMessage does not throw the  exceptions raised in the child process.
var process_instance = runtimeService.startProcessInstanceByMessage("MyMessageName", variables);
if (process_instance) 
{
    log.info('Started {}', process_instance.getId());
}
else
{
	log.error('Starting process failed');
}

You need to add a message start event to your child process.
There may be a way to start the process using a non specific start event. Have a look at the runtimeService documentation.

Hi @maudrid,

Just curious, why don’t you use a service task here. Any particular reason?

Thanks,
Rémi

Do you mean instead of a script task?
If this is what you mean, then the reason is because our users do not have access to deploy new service tasks. They are not developers and cannot compile new jar files to deploy. But they can write simple Javascript and see the results instantly using a Web based process editor.

Yes, this is what I meant.
(I was wondering if there was any specific technical reason, for example related to transaction propagation, preventing the use of service tasks here)