JBoss Community

Re: Is anyway to get the subprocessinstance id using the Mainprocess instance Id

created by saig0 in jBPM - View the full discussion

Hi Shiju John,

 

you can not get the sub process instance id from the parent process. This relationship between process instance and sub process instance is not stored in a table.

But you can check the class SubProcessNodeInstance. This class represents a sub process call activity and start the sub process instance. See the following code:

 

ProcessInstance processInstance = ( ProcessInstance ) ((ProcessInstance) getProcessInstance()).getKnowledgeRuntime().startProcess(processId, parameters);
this.processInstanceId = processInstance.getId(); 
((ProcessInstanceImpl) processInstance).setMetaData("ParentProcessInstanceId", processInstance.getId()); // note: wrong process instance id

 

You can try to read the property processInstanceId from class or build your own logic.

Reply to this message by going to Community

Start a new discussion in jBPM at Community