2 Replies Latest reply on Jul 25, 2012 9:31 AM by mylos78

    jBPM5 Process Variables

    mylos78

      Hi all,

      I'm trying to migrate a process which was build on jBPM3 with the new jBPM5.

      I have an old decision node which I have turned into a Gateway, adding into it (using Eclipse jBPM plugin) the constraint:

       

      return workorder > 100;

       

      Now I'm trying to start the process using

       

      Map<String, Object> inputParams = new HashMap<String, Object>();

      inputParams.put("workorder", new Long(1500));

       

      // start a new process instance

      ksession.startProcess("com.graph.process1",inputParams);

       

      However at runtime I get the following error

       

      Could not find variable 'workorder' for action 'return workorder <= 100;' : org.drools.lang.descr.ProcessDescr@36527f

      How can I reference a startup process variable in the Gateway constraint ?

      Thanks

      Mylos

        • 1. Re: jBPM5 Process Variables
          amin-mc

          did you define workorder as a process variable in your process definition?

          • 2. Re: jBPM5 Process Variables
            mylos78

            Thanks, by defining the workorder variable as "property" in the process it works.

            Coming from a jBPM3 background I thought that passing the HashMap in the creation of the process would do automatic initialization of the variable.

             

            May I ask just one more query about variables ? how do you modify a variable via API ?

            org.drools.runtime.process.ProcessInstance does not seem to include any set/get variable. The documentation talks about kcontext

             

            kcontext.setVariable(variableName, value);

            However I would expect to extract a variable at process level......

            Regards

            Mylos