6 Replies Latest reply on Dec 5, 2015 5:03 AM by Gulam Samdani

    How to use Exclusive gateway in jbpm 6.2

    Francesco Scarcella Newbie

      Hello to all,

      i would realize this simple process



      when my user complete the task i would to pass a parameter that will be evaluated for the decision at gateway point and if that parameter is true "script ok" will be executed else will be executed "Not allowed".

      I insert a java expression on the row in output from the first gateway ( return  KieFunctions.equalsTo(esito, "false"); and return  KieFunctions.equalsTo(esito, "true"); )

      I would realize a webapp in java code (jsf and ejb)

      The code to complete task


      private UserTaskService userTaskService;


      Map<String,Object> outputParams = new HashMap<String,Object>();
      outputParams.put("esito", "false");

      CompositeCommand compositeCommand = new CompositeCommand(new CompleteTaskCommand(taskId, user, outputParams),new StartTaskCommand(taskId, user));

      userTaskService.execute(it.test.workflow:test_process:1.0, compositeCommand);



      human task complete succesfully but "esito" is null, infact if i insert return  KieFunctions.equalsTo(esito, null);  in a branch, the proces will continue over that branch otherwise i have an error due to the decision, infact gateway can't decide because esito is NULL.


      I hope that i have been clear enough and someone could help me.




      Messaggio modificato da Francesco Scarcella

        • 1. Re: How to use Exclusive gateway in jbpm 6.2
          Francesco Scarcella Newbie

          I solved.

          the error was in the name in my outputParams.

          I define the outputSet in my userTask with kie-wb and the name was esito_ instead in my java code i put the value with esito as a key.

          this video to use gateway is very helpful https://www.youtube.com/watch?v=D8EMUgBqSHQ


          thank you very much.

          • 2. Re: How to use Exclusive gateway in jbpm 6.2
            Michael Awizen Novice

            Hi Francesco,


            have you considered defining a Data Object on the process level to transport the value of the user action? You could use this Data Object in your gateway directly for the evaluation and finally for the navigation in the process.




            • 3. Re: How to use Exclusive gateway in jbpm 6.2
              Francesco Scarcella Newbie


              i need only a parameter with true or false value. A data object seemed excessive for me.

              With my solution i set my parameter directly from code.


              My situation is an extreme integration between JBPM and another application, and from the application i manage the workflow created from third party and i think is more simple manage true or false rather than an object

              what do you think about it?

              • 4. Re: How to use Exclusive gateway in jbpm 6.2
                Michael Awizen Novice

                I just tried another approach: to configure more in the graphical process editor and to write less code. At the moment I'm not sure if I like this way

                In this approach it seemed to me that a process scoped data object is required to map task variables. In my case the data object is just a string variable. The output data mapping form the local task variable to the process variable ( the data object) is configured directly in the process. Subsequently the evaluation of this process variable is defined also in the process description in the gateway.


                What I have to do in the java code is to pass a map with variables when completing the task. E.g.:


                Map<String, Object> results = new HashMap<String, Object>();
                results.put("userAction", "startTheMachine");
                taskService.complete(taskSummary.getId(), "userA", results);
                • 5. Re: How to use Exclusive gateway in jbpm 6.2
                  Francesco Scarcella Newbie

                  That seems the same approach i used

                  i defined a process variable and mapped them on my process.


                  User task has an output esito_ mapped to esito as process variable and then the branch of the gateway evaluate esito.equls("true") (or false), from java code, i set esito_ using a map similary to your approach.


                  i also tried to use taskService.complete(taskSummary.getId(), "userA", results);  but i had an error, something like "forbidden exception"

                  • 6. Re: How to use Exclusive gateway in jbpm 6.2
                    Gulam Samdani Expert

                    Hi, Francesco Scarcella,

                    I am facing same problem.

                    According to this video tutorial : https://www.youtube.com/watch?v=D8EMUgBqSHQ


                    I have develop a business process , it deploy and process started successfully ok, but when i am  task complete / release from Task list then it will give this error .

                    i am try to do this several time but always i am got this "stupid " error .



                    Error :


                    Caused by: java.lang.RuntimeException: unable to execute ReturnValueEvaluator:


                    Caused by: java.lang.RuntimeException: Exception when trying to evaluate constraint  in split

                    My Input /output data is :




                    please help me.