2 Replies Latest reply on Oct 20, 2005 3:21 PM by mangeshd

    How to store Process Definition using identifier


      I have created a variable associated with a process instance in the ActionHandler.
      context.getProcessInstance().getContextInstance().createVariable("status", "PENDING");

      I saved the process instance using "jbpmSession.getGraphSession().saveProcessInstance(processInstance);"

      Now I want to retrieve the value of this variable in another method. So how do I load the previous Process Definition i.e. how do I save the Process Definition or instance with a unique ID?
      Need some urgent help on this please.

      I tried the follg. code but it doesnt work :-
      ProcessDefinition processDefinition = jbpmSession.getGraphSession().findLatestProcessDefinition("LeaveApp");
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      This returns a NULL value

        • 1. Re: How to store Process Definition using identifier

          Hi there,

          It looks like you're saving the variable in process instance A and then creating a new process instance B and trying to get the variable value out of B. Try something like:

          myProcessInstance.createVariable("status", "PENDING");
          long processId = myProcessInstance.getId();

          save your processId somewhere, then later:

          ProcessInstance myProcessInstanceReloaded =
          Object savedValue = myProcessInstanceReloaded .getContextInstance().getVariable("status");


          • 2. Re: How to store Process Definition using identifier

            Thanks a lot brian...it worked !!!