AnsweredAssumed Answered

cannot update task

Question asked by mezga on Sep 23, 2014
Latest reply on Jul 14, 2016 by
I fighted through alfresco javascriot API. My goal is to get all
workflow-instances of my custom workflow in the system and update the actual task all of the workflows.
I could fetch the Workflowdefinition -> get the active instances and iterating through them.
I get the JscriptWorkflowPath of the actual instance and get the only task of the workflow
(by definition my workflow has only one step)
I have a JscriptWorkflowTask object, see the properties of my task and I am happy.
But when I try to update my task I got an exception below. I could figure out that
contains workflowId which is obviously wrong.

How Can I update my tasks?

Do you have any workaround for my situation?

function main() {
   // get all of taskInstances
   var workflowDef = workflow.getDefinitionByName("nameOfMyWorkflow");
      var activeInstances = workflowDef.getActiveInstances();
   // iterate over the instances
   for (var index = 0; index < activeInstances.length; index++) {
      var workflowInstance = activeInstances[index];

      var workflowId =;

      // get the JscriptWorkflowPath object
      var paths = workflowInstance.paths;
      logger.log('paths: ' + paths );
      var workflowPath = paths[0];
      // get the JscriptWorkflowTask object
      var tasks = workflowPath.tasks;
      logger.log('tasks : ' + tasks );
      var task = tasks[0];
      logger.log('task : ' + task);
      // here we got the properties of the task
      var prop =;
      logger.log('prop : ' + prop);

      var taskId =;
      prop['{}description'] = "test text";


500 Internal Error Stacktrace-Details: org.alfresco.service.cmr.workflow.WorkflowException:
08233626 Failed to update workflow task activiti$start301, the task doesnt exist. An error inside the HTTP server
which prevented it from fulfilling the request. 08230036 Wrapped Exception (with status template): 08233627
Failed to execute script 'Javascript Console Script': 08233626 Failed to update workflow task activiti$start301,
the task doesnt exist.

Note: I use for javascript development on Alfresco Enterprise v4.1.5