3 Replies Latest reply on Dec 10, 2009 7:50 PM by harish21

    Process Variables

    tejjbpm

      Hi

      I created a new instance of a process and set some variables to it using

      // Create a new process instance with the new variables
       Map<String,Object> variables = new HashMap<String,Object>();
       variables.put("employee", "mike");
       variables.put("requestType", "m");
       variables.put("requestDetails","details");
      
       ProcessInstance processInstance = executionService.startProcessInstanceByKey("m",variables);


      Now how i do access these variables. I dont see any method at the processinstance level to get all the variables based on process instance id.

      Also, Can I add more process variables when the process is moving between task to task. basically I want the process to remember some of the variables until it is completed..I dont know whether i framed the question correctly enough!!


      Thanks in advance


        • 1. Re: Process Variables
          sebastian.s

          Process instance variables are associated with an execution. So you need the executionId. Since you supplied the variables right at the start of the process they belong to the parent execution which id equals the processInstanceId (AFAIK). So you can retrieve the variables programmatically by using the processInstanceId.

          Within a process definition you can use expressions to access process instance variables. For this refer to the user guide.

          You can always add additional variables to the process. See the set-method for process instance variables for this.

          • 2. Re: Process Variables
            tejjbpm

            Hi Sebastian

            Thanks for the reply.. My mistake was to check at the process instance level while I am suppose to check at the execution level and task service level.
            I got it working. Thanks for your detailed explanation.

            • 3. Re: Process Variables

              @TejJBPM

              hi , can you please post the code to get the process variables during the time of execution?

              Thank you