I'm trying to do a script to get all active tasks for a workflow:
<javascript> //…
var workflows = doc.activeWorkflows;
var nWorkflows = workflows.length;
if (nWorkflows > 0) { for each ( var workflow in workflows ) { var workflowId = workflow.getId(); var workflowActiveTasks = workflow.WHAT_FUNCTION_HERE;
(…) }
}
//… </javascript>
Is there function to retrieve all active tasks for a workflow?
Hi and thanks for the reply… I trying to do what you suggest:
<javascript> //…
var workflows = doc.activeWorkflows; var nWorkflows = workflows.length; if (nWorkflows > 0) { for each ( var docWorkflow in workflows ) { //docWorkflow is an JscriptWorkflowInstance? var docWorkflowId = docWorkflow.getId(); var workflowDefinition = workflow.getDefinition(docWorkflowId); var activeInstaces = workflowDefinition.getActiveInstances(); var nActiveInstaces = activeInstaces.length; logger.log("ACTIVE INSTANCES: " + nActiveInstaces); } }
//… </javascript>
But i'm getting an id error… "Workflow definition jbpm does not exist"…