AnsweredAssumed Answered

Multi Instance User task assignee overwriting

Question asked by darkredd1 on May 15, 2013
Latest reply on May 28, 2013 by darkredd1
Good day All,

We are using the Activiti engine that came bundle with Alfresco 4.1*.
We have a custom workflow developed. In this workflow we have a review task that is a multi Instance, what happens is if any of the reviewer (starting from the second person) rejects, it goes back to the initiator. Once the initiator has made adjustments, they can send it back to the reviewer who rejected the document.

What we would like help with is the overwriting of the original assignees with reviewer who rejected and those ahead of them in the task; so if there are 4 Reviewers and the 3rd rejects. When the flow comes back, the userTask should be assigned to the 3rd reviewer followed by the 4th in the loop.

What we have tried was using the TaskService interface with no success, here is the implementation we tried with:

<blockcode>
package dac.gov.controller;

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Logger;

import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;

public class RecommendationUser implements TaskListener
{
   @Override
   public void notify(DelegateTask execution)
   {
      // TODO Auto-generated method stub
      String user = execution.getVariable("sita_recommenders").toString();

      try
      {
         TaskService task = TaskService.class.newInstance();

         task.setAssignee(execution.getVariable("taskid").toString(), user);
         log.info("Reassigning");
      }
      catch (InstantiationException e)
      {
         // TODO Auto-generated catch block
         e.printStackTrace();
      } catch (IllegalAccessException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
   }
}
</blockcode>

If there is a way of achieving this please help.

Regards
DarkRedd

Outcomes