AnsweredAssumed Answered

Field Injection for UserTasks

Question asked by on Sep 19, 2014
Latest reply on Sep 25, 2014 by
From the documentation, I see that field injection is supported for Service tasks. I just wanted to know if the same is supported for user tasks too. Something like this:

<userTask id="auditPhase1" name="Audit Phase 1">
      <activiti:field name="actions" stringValue="Approve,Reject,Reprocess" />

We have a requirement to show the list of tasks defined in the work flow and supported actions for each task. There are several audit tasks which are modeled as user tasks in our workflow. And each audit task can have different actions supported. For ex: Approval, rejection, Re-process data. So I just wanted to know if I can store that information in user task definition itself.

Here is how we are fetching task details:

ProcessInstance processInstance = getProcessInstance(dataId);
BpmnModel model = getBpmnModelForProcessDefinition(processInstance.getProcessDefinitionId());
List<TaskDetail> taskDetails = Lists.newArrayList();
for(Object obj : model.getMainProcess().getFlowElements()) {
   if(obj instanceof ServiceTask) {
      ServiceTask serviceTask = (ServiceTask)obj;
      taskDetails.add(new TaskDetail(serviceTask));
   } else if(obj instanceof UserTask) {
      UserTask userTask = (UserTask)obj;
      taskDetails.add(new TaskDetail(userTask));

So now if the actions can be stored as fields in the user task definition itself, then I can fetch and store that information in the above code. Please suggest!