1 Reply Latest reply on Oct 18, 2013 2:38 AM by swiderski.maciej

    JBPM5 Service Task Process Variable

    ragramaiah

      Hi,

       

      How to set Process variable from main program and/or from ServiceTask Handler process where processInstance is started?

      processVariables.put("XYZ",objValue);

      ksession.startProcess("SampleProcess",processVariables); where processVariables = Map<K,V>

       

      My bpm flow has 2 custom Service Tasks with respective handlers. I need to use above processVariables in one of the services like below

      ......

      public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {

      //how to access process variables(processVariables) that are set in main program?

       

      Object obj = workItem.getParameter("XYZ");//to retrieve the value which is set in the main program

       

      // can I change the value of processVariable here, so that I can use that value in next step?

      }

       

      The obj value is null in this case. Please let me know if I am following the right way or else let me know the correct way

        • 1. Re: JBPM5 Service Task Process Variable
          swiderski.maciej

          you need to pass the variables into completeWorkItem method then these will be available for data output mapping defined in your process definition (bpmn2) that will be responsible for setting these as process variables that then will be available to further activities.

           

          HTH