cancel
Showing results for 
Search instead for 
Did you mean: 

[JavaScript] How to get all task of workflow instance

poldet
Champ in-the-making
Champ in-the-making
I would like to get all the task instance from workflow instance (Include COMPLETED task) for JavaScript APIs
I've spend a long while searching for getting task. But everything i've got is to get paths from instance and then get task from path. but getPaths() just only contain in progress path not include completed path.
Like this
<javascript>
var workflowInstance = workflow.getInstance(wfInstanceId);
for each (var path in workflowInstance.getPaths()) {
   for each (var task in path.getTasks()) {
     // Collect in progress task.
   }
}
</javascript>
All my hope should be here. My last option is to use RESTful APIs http://localhost:8080/alfresco/service/api/workflow-instances/${workflowInstanceId}/task-instances but if it possible don't let me go that way it's very non sense.

Thanks for all reply.
4 REPLIES 4

kaynezhang
World-Class Innovator
World-Class Innovator
You can't use  RESTful APIs
http://localhost:8080/alfresco/service/api/workflow-instances/${workflowInstanceId}/task-instances 
it returns all workflow task Instances associated with an speicified authority.
If you didn't specify an authoriy ,tasks for the current user will be returned.

poldet
Champ in-the-making
Champ in-the-making
thanks kaynezhang but still waiting for my answer.

kaynezhang
World-Class Innovator
World-Class Innovator
I'm afraid now you can't get all tasks by using javascript api that ,why do you want to get all task?

You can implement this function  by using java api
 
org.alfresco.service.cmr.workflow.WorkflowService.queryTasks();

Hi Kayne, how can I call this REST API :

http://localhost:8080/alfresco/service/api/workflow-instances/

from my rule JavaScript file ?