cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the numbers of tasks assign to an user

theoryoflinkin
Champ on-the-rise
Champ on-the-rise
Hi,

I was wondering if there is a simple way to get the number of tasks assigned to an user inside by using a workflow script.

I don't find anything about it

Thanks in advance.
7 REPLIES 7

kaynezhang
World-Class Innovator
World-Class Innovator
If you want to get lenght of  tasks that are assigned to the current user and that are currently in-progress.
Following code should be ok

var tasks= workflow.getAssignedTasks();
var length = tasks.length;

Hi,

Thank you for the answer.

But I was wondering if it will return all the tasks of all workflows or only all the tasks of the current worfklow? (about me, the official doc is not clear)

(actually, I need all the tasks of all workflows)

kaynezhang
World-Class Innovator
World-Class Innovator
workflow.getAssignedTasks() 
will return tasks assigned to the current user. note that this will only return in-progress
I'm afraid there is no javascript api  can return all the tasks of all workflows

Very bad news 😞

I think I will have to find a solution to get this information

Maybe should I developp something custom to get this? A script? A java class?

You can use
org.alfresco.service.cmr.workflow.WorkflowService.queryTasks() 
method of java servcie api.

Thank you for the advice. I finally did what I wanted 🙂

Here is the link of my solution: https://forums.alfresco.com/comment/147868#comment-147868

Thank you for your advice 🙂

Here is the link to the solution I made: https://forums.alfresco.com/comment/147868#comment-147868