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

    How to store Process Definition using identifier

    mangeshd

      Hi,
      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);
      processInstance.getContextInstance().getVariable("status");
      This returns a NULL value

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

          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");
          jbpmSession.getGraphSession.saveProcessInstance(myProcessInstance);
          long processId = myProcessInstance.getId();


          save your processId somewhere, then later:

          ProcessInstance myProcessInstanceReloaded =
           jbpmSession.getGraphSession().loadProcessInstance(processId);
          Object savedValue = myProcessInstanceReloaded .getContextInstance().getVariable("status");


          Brian

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

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