AnsweredAssumed Answered

How to properly start a new process from inside a service task ?

Question asked by guillaume1 on May 22, 2014
Latest reply on Jun 4, 2014 by jbarrez
Hello,

I have created a custom palette element following the user guide about this topic.

This new activity is in fact a 'configuration mask' for a CallActivity with a complex input map.

So the execute method of the JavaDelegate that is called by this custom palette element at runtime is like this:

<java>
@Override public void execute(DelegateExecution execution) throws Exception {
   // prepare the variables from the execution

    runtimeService.startProcessInstanceByKey("ProcessToStart", execution.getVariables());
  }
<java>

It works, but then I have a problem with historical queries:
processes started with way don't have any parentId.

So my questions:
- Is it the right way to do? Should I change the type of the javaDelegateClass used in my custom component ? If not what should I use ?
- If it is the right way, how should I start the sub process in order to have a parent defined to it ?

Outcomes