4 Replies Latest reply on Jan 28, 2011 10:04 AM by candy_633

    JBPM 5 variable (Result Mapping Problem)

    candy_633 Newbie

      Hello, JBPM friends,


      I am a beginner with JBPM 5, could I ask a question related to variable?


      I want to passing Java class parameters through JBPM nodes. Using "Parameter Mappping" in properties of graph can control input parameters of nodes, which is also <dataInputAssociation> in xml. But "Result Mapping" is not working. I can not passing parameters out and send it to the next node.


      Do you know how to realize this?


      I appreciate your help so much!


      Best Regards,



        • 1. JBPM 5 variable (Result Mapping Problem)
          Kris Verlaenen Master

          Here's an example:



          Did you define your variables you are mapping your parameters to as a process variable?

          And are you sure that the data that is being passed in as the result is not null?



          • 2. JBPM 5 variable (Result Mapping Problem)
            candy_633 Newbie

            Dera Kris,


            Thank you so much for your reply. I guess the problem is related to my Java code. Could you please help me take a look at it? I attached my test project "HelloJBPM.zip" to the article on the first floor.



            I appreciate your help so much!



            I tried your example, there are some errors:


            1) seems my code could not call: ServiceTaskHandler(), even I import org.jbpm.bpmn2.handler.ServiceTaskHandler;


            2) my code could not identify <serviceTask; I am using <task id="_4" name="RecordHandler" tns:taskName="Handler" >, is it because of different version?



            Thanks you so much!




            • 3. JBPM 5 variable (Result Mapping Problem)
              Kris Verlaenen Master

              You are using a task with task name "Handler" and registering your WorkingHandler, so that will be invoked when the task needs to be executed.  If you want to pass data back in as the result of the execution, you should however do so when completing your work item, for example:


                          Map results = new HashMap();

                          results.put("MyResultParam", "MyValue");

                          manager.completeWorkItem(workItem.getId(), results);


              Your result mapping also seems to be incorrect.  In this case, you should map the value of the parameter "MyResultParam" to the process variable "Result" in the result mapping: {MyResultParam=Result}

              This looks like this in bpmn2 xml:

                  <task id="_4" name="Notification" tns:taskName="Notification" >



                      <dataOutput id="_4_MyResultParamOutput" name="MyResultParam" />












              After that, your value should be written out in the final script task.



              • 4. JBPM 5 variable (Result Mapping Problem)
                candy_633 Newbie

                Thank you so much Kris for helping us!!!