14 Replies Latest reply on Dec 30, 2014 9:09 PM by SANJAY GAUTAM

    Hi ,unable to map variables in Human Task

    khirod panda Newbie

      Hi ,

       

      I am new to JBPM (evaluating)

      i have created a sample process where i am sending 2 values to process while stating (using junit)  and in the human task i am trying to assign the value sent  in to a newvariable  and ten do a SOP of the new valiable after assignment .

       

      I have mapped the Human Task I/O parameters ( input contains pNo1  and i am assigning the value to tNo1) .

       

      1.jpg

       

      2.jpg3.jpg

       

       

      Any help will be of great Help .

       

       

      Thanks

      Khirod

        • 2. Re: Hi ,unable to map variables in Human Task
          khirod panda Newbie

          HI Darren ,

          Thanks for looking into this .

          I am trying to pass a varibale from start node to 2nd task in my flow and do some Math calculation in the 2nd Human task and then show the result (may be system out in 2nd task ).

           

          But i am not able to pass the varibale successfullt to diffrenet tasks.

           

           

           


          • 3. Re: Hi ,unable to map variables in Human Task
            Darren Osten Newbie

            It is hard to tell on the screenshots, but do you have a output mapping from tNo1 back to pNo1?

            • 4. Re: Hi ,unable to map variables in Human Task
              khirod panda Newbie

              HI Darren ,

              Thanks for looking into this .

              let me put in detail what  am doing or betetr trying to do :-

               

              I want to pass 2 varibales and an operator (i.e + or - )

               

              from Start task to task 1 and check the values in Stask 1 if all values are present then passon the same details to Task 2 and then do an arithmetic operation based on the OPerator (i.e. + or -)  .

               

              so what i have done is :-

               

              i have defined follwoing  varibales at process level (as u can see in screen shot 1)

              1. pNo1
              2. pNo2
              3. pOpr
              4. pResult
              5. tNo1
              6. tNo2
              7. tOpr
              8. tResult

              now to get the varibale in Task1 , I have mapped in I/O Parameter mapping , in INput Parameter mapping follwoing :-

              1. Hello World/pNo1 to pNo1
              2. Hello World/pNo2  to pNo2

              3. Hello World/pOpr to pOpr
                Then i am printing the values in Task1 as SOP for all 3 values System.out.print(pOpr) and ia m able to see all the 3 values and can see that values are present

              Now my job is to pass on the same value to Task 2 for the arithmetic operation , for that what i am doing is :-

               

              defining in outpout parameter mapping as following

              • Hello World/pNo1 to tNo1
              • Hello World/pNo2 to tNo2
              • Hello World/pOpr to tOpr

               

              then in the Task 2 i am trying to see if i am getting the value of tNo1, tNo2, tOpr  but i see it is null there .

               

              i should get teh values as passed and then do a arithmetic operation and print the values in Task2.

               

              Hope this will help you to get teh details and help me .

               

              Thanks

              • 5. Re: Hi ,unable to map variables in Human Task
                Darren Osten Newbie

                Your output mapping looks to be backwards.  You need to map the input variables back out to the process variables if you want them available in other tasks.  So in your example, pNo1, pNo2 and pOpr are local to Task1.  You need to make output mappings back to Hello World/pNo1 etc.  I don't use the Eclipse editor so I am not sure how to do the mapping there.

                • 6. Re: Hi ,unable to map variables in Human Task
                  SANJAY GAUTAM Expert

                  Hi Khirod

                   

                  I havent gone that far to use eclipse but I believe this can provide you some insight into how to map them all.

                  Process Level

                  Variable-1.png

                   

                  TestClient1 Task Level Data Input

                  Variable-2.png

                   

                  TestClient1 Task Level Data Output


                  Variable-3.png


                  Test Client Mapping Level Assignments Level


                  Variable-4.png

                  I believe if you run the co-relation between these screen shots you might be able to get the eclipse thing get going or might be able to rationalize how it should be in the eclipse GUI.

                  I would as well open the bpn process inside the eclipse the same one this is a standard jbpm-playground  example which you can open and try to find out how they are correctly map.


                  Sanjay



                   

                  • 7. Re: Hi ,unable to map variables in Human Task
                    SANJAY GAUTAM Expert

                    Hi Daren ,

                     

                    I have different question if you might help me. I following set up 

                     

                    Screen Shot

                    PersonIssue.png

                     

                     

                    Question

                    The issue is that "person" which is defined at the process level and also being correctly mapped in the "Simple Task" and inside the "Business Rules" part the instance is available and it is not null

                    but when it comes down to the arrow path XOR it becomes null and I cannot return the correct flag based on the value set up by the Business rule .

                    I want to pass the expression like return person.getAdult() == true ; but as the Person is null it is not working.

                     

                    It will be a great help if you can suggest some tips to trouble shoot this.. I am doing everything right I believe so ..but .. some how it is not coming up ..

                    • 8. Re: Hi ,unable to map variables in Human Task
                      Darren Osten Newbie

                      Sanjay, hard to tell what is wrong.  Try explicitly setting the process variable at the end of the "check person" script task.  An example would be:

                      kcontext.setVariable("person", person);

                      • 9. Re: Hi ,unable to map variables in Human Task
                        SANJAY GAUTAM Expert

                        Yes that's what I have thought for but I am surprise it works fine for the Cascading Human Tasks but for the "Business Rule Task" it doesn't work the same way. ? is that by design or it is defect that was my main concern.  - Thanks for responding though. it helped me to concur the thoughts with your suggestion.

                         

                        If you get chance probably try the simple flow and test this functionality at your end. Because I feel that if I do the correct "Data Assignments" inside the "Business Rule Task" I expect that person object should get populated with the correct instance of the object as per the assignment and I don't have any other way to confirm this behavior.   I believe swiderski.maciej videos didn't to any thing special and it worked for him I think there is definitly something wrong I am doing. I still feel that I should not do kcontext.setVariable. it should work out of the box. by setting the Data Assignments.

                         

                        I believe he sees this discussion he might have some Idea about it.

                         

                        Thanks

                        Sanjay Gautam

                        • 10. Re: Hi ,unable to map variables in Human Task
                          SANJAY GAUTAM Expert

                          I tried setting up via kcontext on the exit actions of the "Business Rule Task" but that doesnt seems to work either .

                          • 11. Re: Hi ,unable to map variables in Human Task
                            Darren Osten Newbie

                            Unfortunately, I have never used business rule tasks so I am not sure how those behave.

                            • 12. Re: Hi ,unable to map variables in Human Task
                              SANJAY GAUTAM Expert

                              Hi khirod panda

                              Please let me know if you were able to find out and were correctly able to map the input and output variables.

                              If you can tell which IDE set up you are using then it will be easy for me to replicate the issue.

                              I installed the eclipse kepler and the JBOSS Tools Kepler 4.1.2 Final version and I see the UI for the process diagrams are different as compare to your screen shot.

                              please share the information my screen shot looks like below.

                               

                              BpmN.png

                              • 13. Re: Hi ,unable to map variables in Human Task
                                khirod panda Newbie

                                Hi Sanjay ,

                                 

                                I was not able to do that .

                                 

                                My Spec is :-

                                Jbos Developer studio 7.1( on top of eclipse) with JBPM plugin added

                                Please let me know if any more detail i can provide to help .

                                Thanks


                                • 14. Re: Hi ,unable to map variables in Human Task
                                  SANJAY GAUTAM Expert

                                  I think i got it what needs to be done actually if you run install all it works fine. I think I didn't used that and hence it didn't installed modeler which is there in Ant Build.xml  - Thanks