6 Replies Latest reply on May 27, 2013 11:17 AM by Shobhit Tyagi

    how do we assign the rejected tasks to initiator in Approval flow.

    Rajesh P Newbie

      Hi,

      I am new to workflow and JBPM. I would like to implement 2 level of approvals work flow. I have created process as explained in the https://community.jboss.org/people/bpmn2user/blog/2011/09/21/jbpm5-web-example link.

       

      At first level approval, we have approve and rejection options. If first level approver is rejected then it has to assigned to creator.

      At this point i am confused, whether i need to invoolve the creator in the process as human task or not. If i have not involved then how can i assign the rejected requests to initiator.

      If i involve him as human task, when and how can i start the process.

      Please correct me if am wrong or my understanding is wrong.

       

      Please let me know if any details required.

       

       

      Thanks in advance.

       

      Rajesh.

        • 1. Re: how do we assign the rejected tasks to initiator in Approval flow.
          Maciej Swiderski Master

          why not model the case completely - first you will have a task for initiator to perform some work, once completed this moves to approval step and if rejected you loop back to the first task for corrections. That way you have clear model that represents the entire flow.

           

          HTH

          1 of 1 people found this helpful
          • 2. Re: how do we assign the rejected tasks to initiator in Approval flow.
            Rajesh P Newbie

            Hi Maciej Swiderski,

             

            I am sorry for the late reply.

             

            Thanks a lot for your reply, Maciej.

            As you suggested, I can have task for Initiator but my question is who is going to start the process?

             

            Please let me know if i am missing any thing.

             

            Please find the attached bpmnn file which i have designed for approval process.

             

            I have few more thoughts

                   I would like to have User task in the rejection flow and pass the persons Id, who started the process, as actor id to the User Task.

                           Suggest me is it a right approach?

                 Can i signal the approval flow after rejection?

                           Correct if i am wrong.

             

            Thanks,

            Rajesh.

             

             

             


            • 3. Re: how do we assign the rejected tasks to initiator in Approval flow.
              Ashish T Newbie

              You have two options to explore

               

               

              1) as suggested Maciej  add a human task representing first form just after the start event and assign it to innitiator.  When the  initiator start the process either do a) first task can go to initiators inbox  or      b) claim first task for intiator and show the first form to initiator. For next Approve/Reject task at a node to this first human task in case of rejection.

               

               

               

               

              2) If you have form before starting the process and form data is fed into the process then you will have to create human task programatically and assign it to initiator on rejection by approve/Reject task.

               

               

              First approach is better as you are able to model first human task in the process.

              • 4. Re: how do we assign the rejected tasks to initiator in Approval flow.
                Shobhit Tyagi Master

                Rajesh,

                 

                You will need to include a human task for the initiator. Because if you dont do it, and if you try and assign the rejected task to the initiator, your first level approval will be out of the definition.

                 

                First task assigned to a variable using expression and set as #{initiator}.

                Second task for the approver. To decide whether the task is rejected or is approved, use a decision node with two transactions coming out. One going back to the initiator task(rejected case) and other to the next level approver(in case the task is approved).

                1 of 1 people found this helpful
                • 5. Re: how do we assign the rejected tasks to initiator in Approval flow.
                  Rajesh P Newbie

                  Thanks Ashish.

                   

                  As you suggested,i would like to go with first approach.i.e, having a human task just after after the start node.

                  I will pass Actor id dynamically as suggested by the Shobhit.

                  And then i would like to claim,start and complete the task after starting the process . I have given sample to do the same below. please validate it is it a right apparoach?

                   

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

                  inputParam.put("initiator","<UserID>");

                  kession.startproces("<process id>",inputParam);

                  //start the task

                  ///complete task

                   

                   

                  Please suggest me on the above approach.

                   

                  Thanks,

                  Rajesh.

                  • 6. Re: how do we assign the rejected tasks to initiator in Approval flow.
                    Shobhit Tyagi Master

                    you could start the process that way. But you also would need to create a process variable for your decision node and you will need to set its value at the time of completion of the approval task.

                    You will need to check its value in the decision node and use the appropriate transition.