2 Replies Latest reply on Oct 9, 2012 10:49 AM by Maciej Swiderski

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

    Shiju John Newbie

      Hi

      Is anyway to get the subprocessinstance id using the parent process instance Id in the case of reusable subprocess.

      Is any table mapping is there ?

      Please help.

        • 1. Re: Is anyway to get the subprocessinstance id using the Mainprocess instance Id
          saig0 Newbie

          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.

          1 of 1 people found this helpful
          • 2. Re: Is anyway to get the subprocessinstance id using the Mainprocess instance Id
            Maciej Swiderski Master

            this was allready fixed on master (5.4.0) so meta data now have correct value for ParentProcessInstanceId. Moreover for 5.4. thehistory table was extended to keep this reference as well. Take a look here for history log query method that can give you subprocess instance based on parent process instance id

             

            HTH