09-23-2014 10:26 AM
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 = workflowInstance.id;
      
      // 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 = task.properties;
      logger.log('prop : ' + prop);
 
      var taskId = task.id;
         
      prop['{http://www.alfresco.org/model/bpm/1.0}description'] = "test text";
      task.setProperties(prop);
   
    }
}
main();
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.
07-14-2016 04:28 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.