3 Replies Latest reply on Sep 17, 2012 1:50 PM by esteban nabetse

    How to define result mapping or exit action that saves task owner

    jemmerling Newbie

      Hi,

       

      This should be simple for any non-novice, it was suggested before however without an example.

       

      So I have a process variable and I want a particular task to store its owner into that variable (say its name is "task2owner"). Is there an expression for that, for example:

       

      task2owner=#{taskOwner}

       

      So if there is a standard expression for the task owner (the above is just a guess at what it might be) then this result mapping would allow subsequent tasks to determine who owned (and completed) task2.

       

      Failing that, I could try defining an on exit action, using kcontext I can get the node instance which I think has a one-to-one correspondence to the task, however the node instance does not seem to have an attribute that explicitly identifies the owner. Perhaps the owner is a variable?

       

      Any suggestion would be greatly appreciated.

       

      Thanks!

       

      --JE

        • 1. Re: How to define result mapping or exit action that saves task owner
          Maciej Swiderski Master

          Here you find an example that shows how to get initial value for assigned user to the user task. However when yo reassign the task this will not have updated information, since you rely on work item information and reassignment happens on task server.

           

          Alternative approach is to define user that really completed the task as task variable so it can be mapped on process instance side again. That in fact would nice if the task server makes it accessible out of the box under a specified key inside result map that is sent over to process engine.

           

          HTH

          • 2. Re: How to define result mapping or exit action that saves task owner
            jemmerling Newbie

            It doesn't look like this works in my case.

             

            I need owner not actor id. I my situation, I only identify a group id then some member of that group claims the task. I want to know which group member claimed it. I am guessing that, with an exit action or script node, there is no way to access the task (which would allow me to identify the owner). Here is my on exit action which didn't work (owner is null):

             

             

             

             

            String owner = (String) ((WorkItemNodeInstance)kcontext.getNodeInstance()).getWorkItem().getParameter("ActorId");

             

            System.out.println("Owner is: " + owner);

             

             

            kcontext.setVariable("manager",owner);

             

             

             

             

            However I think I can handle this OK on the application side i.e. the task owner will identify theirself to the process instance.

            • 3. Re: How to define result mapping or exit action that saves task owner
              esteban nabetse Newbie

              Hi Jemmerling,

              Did you manage to obtain the Owner from exit action?

              Unfortunately i can't handle it from the application side