AnsweredAssumed Answered

End Workflow Task - Java

Question asked by fordville on May 9, 2011
I'm nearing the completion of a proof-of-concept project for a client.  The goal was to accomplish our tasks using the Javascript API.  We've nearly accomplished that, but it appears that we need to use Java for one outstanding task…we need to end a workflow task (transition to the next if any) and allow the user to reassign the task to another user.  It will be a major detractor for Alfresco with our client that we can't do everything in the Javascript API, but if I can provide this in a timely manner it will help Alfresco's case…Anyhoo

I'm sure such a Java-backed script have been written by someone.  Can someone share?  This controller would be envoked when the user signals completion of a workflow task and one of the inputs will be the username of the person who should be assigned the next task.

My Javascript controller looks like this (it ends the task, but fails to assign a new bpm:assignee):

var task = null;
var version = server.version;
var versionNum = parseFloat(version);
if (versionNum >= 2.9)
{
   if (args.task_id != "undefined")
   {
      task = workflow.getTaskById(args.task_id);
   }
   model.transitions = workflow.getTransitions;
  if (task != null)
   {
      task.endTask(args.trans_id);
   }
}
var assignTo = people.getPerson(args.assignto);
// workflow_name.parameters["bpm:assignee"] = assignTo; //doesn't work!
model.task_id = args.task_id;

Any assistance would be appreciated.  (I received some advice on assigning a new bpm:assignee and thanks!)  Java backed webscripts are a new area, hence the call for additional help.

Thanks!

Bruce

Outcomes