cancel
Showing results for 
Search instead for 
Did you mean: 

Update task properties

johanpi
Champ in-the-making
Champ in-the-making
I have created a javascript page to upload content and set workflow. Please help
I cannot get the move/transition to work

My create workflow
function doWorkflow(wupload){   if (wupload != null)   {      try      {         // Get the workflow definition         var workflowDefinition = workflow.getDefinitionByName("jbpm$con_rfswf:changeANDrequest");         // Create the workflow package to contain the file nodes         var workflowPackage = workflow.createPackage();         var assignees = new Array();         var workflowParameters = new Array();         var futureDate = new Date();               futureDate.setDate(futureDate.getDate() + 7);         workflowParameters["bpm:workflowDueDate"] = futureDate;          workflowPackage.addNode(wupload);         assignees[0] = lstApprover;         workflowParameters["bpm:assignee"] = assignees[0];         workflowParameters["bpm:workflowDescription"] = wupload.name;         var workflowPath = workflowDefinition.startWorkflow(workflowPackage, workflowParameters);      }      catch(error)      {         status.code = 500;         status.message = "error=" + error;         status.redirect = true;      }   }}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

My move/transition
function transitionsByID(taskID){   var task = workflow.getTaskById(taskID);   try   {      var assignees = new Array();      assignees[0] = lstApprover;      var workflowParameters2 = new Array();      var futureDate = new Date();            futureDate.setDate(futureDate.getDate() + 17);      workflowParameters2["bpm:dueDate"] = futureDate;       workflowParameters2["bpm:assignee"] = assignees[0];//workflowService.setVariable("bpm:assignee", assignees[0]);workflowService.updateTask(taskID,workflowParameters2,null,null);      workflow.endTask(taskID, "Service Provided");   }   catch(error)   {      status.code = 500;      status.message = "error=" + error;      status.redirect = true;   }   return task;}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
12 REPLIES 12

giafar
Champ in-the-making
Champ in-the-making
Hi,
just
var task = workflow.getTaskById(taskId);task.endTask(transId);‍‍‍‍

giafar
Champ in-the-making
Champ in-the-making
Hi,
but how can you call workflowService.updateTask ?
In a web script workflow.workflowService is "undefined" !
Can u help me ?

mrogers
Star Contributor
Star Contributor
Reading this page.
http://wiki.alfresco.com/wiki/Workflow_JavaScript_API#JscriptWorkflowTask

It looks like you can access the "properties" directly from the Java Script Task.

johanpi
Champ in-the-making
Champ in-the-making
Sorry
workflowService.updateTask ? was from another sample.

I cannot find updateTask. It only endTask.

Regards

mrogers
Star Contributor
Star Contributor
workflowService.updateTask is Java API, not Java Script.

johanpi
Champ in-the-making
Champ in-the-making
Is there anyting in javascript I can use to update properties like assignee?

Regards

mrogers
Star Contributor
Star Contributor
From the documentation you can update the properties directly.

johanpi
Champ in-the-making
Champ in-the-making
Sorry for laboring the point.

I cannot see how.

Could you indicate one example?

Thanks

rivarola
Champ on-the-rise
Champ on-the-rise
Hi Johan,

Did you find a solution to this problem ?