1 Reply Latest reply on Jun 16, 2010 2:44 AM by rebody

    How to Get Parent Process Id/Key in Subprocess

      Hi All,

       

      I have a usecase where in I need to know the Parent Process id/key inside a SubProcess's Custom task.As I need to identify which parent Processinstance has called the current Subprocess.

       

      Inside the SubProcess's Custom Task I have tried following ways to get the parent Process ID but all of them failed to do so :-

       

      public

       

      class SubProcessCustomTask implements ExternalActivityBehaviour{

       

       

       

      private static final long serialVersionUID = 1L;

       

       

      @Override

       

      public void signal(ActivityExecution arg0, String arg1, Map<String, ?> arg2)

       

      throws Exception {

      arg0.take(arg1);

       

      // TODO Auto-generated method stub

       

      }

       

       

      @Override

       

      public void execute(ActivityExecution arg0) throws Exception {

       

      System.out.println("arg0.getParent().getId()##"+arg0.getParent().getId());  // Throws Null pointer Exception

      System.out.println("arg0.getProcessDefinitionId()##"+arg0.getProcessDefinitionId()); //Does not return Parent Process id

      System.

      out.println("arg0.getId()##"+arg0.getId()); //returns Subprocess ID

      }

      }

       

       

       

       

       

      }

       

       

       

      Can someone please throw some light on how to get the Parent Process Id from which the current Subprocess's Custom task has been called.

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

        • 1. Re: How to Get Parent Process Id/Key in Subprocess
          rebody

          Hi Apurv,

           

          Unfortunately,  we cannot get super process from Execution interface.  If you need to get the super process defintion id, you have to cast execution to ExecutionImpl.

           

           

          ExecutionImpl executionImpl = (ExecutionImpl) execution;

           

          executionImpl.getSuperProcessExecution().getProcessDefinitionId()