2 Replies Latest reply on Sep 1, 2005 12:22 PM by arun makhija

    Access to sub process in subprocess-end event

    Alejandro Guizar Master

      Hi Andreas,

      The sub process instance is only available from the token as long as the token is in the process state. Consider the token marks a particular node within a process definition. Once it leaves that node, it is weird to keep the sub process instance, since it is unrelated to the new node.

      Feeding/extracting data through variable mappings is the preferred means to exchange information between the super and sub process instances.

      If you absolutely need the process instance, query the database directly:

      select instance
      from ProcessInstance instance, ProcessState state
      where instance.superProcessToken.id = :tokenid
       and state.id = :stateid
       and state.subProcessDefinition = instance.processDefinition

      If you're sure your token does not spawn any other sub process, you can drop the clauses that refer to ProcessState. Conversely, if your token instantiated the same sub process definition in different states, you will have to pick a process instance based on creation order.

      Alternatively, you can save the sub process instance id in a variable within the subprocess-created or subprocess-end events and load it directly.

        • 1. Re: Access to sub process in subprocess-end event
          Andreas Schulz Newbie

          Thanks Alex,

          for your response.

          We solved the problem with variable transfers between the process and its subprocess.

          But still, I am not sure, if it should not be possible to access my sub process in an actionhandler in the "subprocess-end" event.
          For what do I have this event?
          I want to react on my subprocess, so I need to identify it!

          Again thanks for your answer!

          Bye,
          Andreas

          • 2. Re: Access to sub process in subprocess-end event
            arun makhija Newbie

            hi Andreas (and anyone else out there)

            I am trying to access paren process variable in the sub-process using variable transfers but I am not getting any variable in an ActionHandler of sub-process

            <!-- Invoking the sub process -->
             <process-state name="parent process">
             <sub-process name="sub-process">
             <variable name="MyName" access="read" mapped-name="MyNameSub" />
             </sub-process>
             <transition name="tr_Next" to="TheNextNode" />
             </process-state>
            


            Is this the correct way of using variable acess ?

            I tried to access the variable "MyName" and "MyNameSub" in one of the ActionHandlers of the sub process, but getting a null

            any help would be appreciated

            Regards
            Arun