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

    How to Get Parent Process Id/Key in Subprocess

    apurv agnihotri Newbie

      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.