List a users tasks using alfresco-js-api

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner

List a users tasks using alfresco-js-api

Hi there,

Does anyone know how to list the tasks asisgned to a user via the alfreso-js-api ?

I'm using the TasksApi.listTasks method but the documentation describing the TaskQueryRepresentation parameter is dreadful. (Unfortunately very typical of Alfresco developer documentation)

https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/activiti-rest-api/docs/TaskQuer...

I'm assuming "assignment" is the option I need to set but all the docs tell me is that its a "string". Great, no help whatsoever.

The REST API docs are no better, again its a string.

I've tried using user names, emails, id etc, but all seem to be ignored. I've even tried putting complete junk into the field and it still returns all tasks for the current user (admin) so I'm begining to think assignment is not the field I'm after.

Any ideas?

Thanks

Paul

3 Replies
Highlighted
Partner

Re: List a users tasks using alfresco-js-api

Ok, so I found some information on "assignment"

Apparently it will accept the values "assignee", "candidate", "group_x" (where x is the group id). Leaving it empty will list tasks that the current user is involved in.

This doesn't help as I need to get the list of tasks that have been assigned to a specifc user (ideally identified by their user id).

Anyone know if this is possible?

The Activiti-Admin app can do it so I could implement my own REST call to mirror what it does. The problem is the admin app wouold require a different login....

 

Paul 

Highlighted
Partner

Re: List a users tasks using alfresco-js-api

Another update...

According to the REST API docs, if I login as an admin user, I can impersonate another user by including:

activiti-user and activiti-user-value-type in the request header.

Where, activiti-user should be set to the required user account identifier and activiti-user-value-type to the user account identifier type. The header activiti-user-value-type can be one of the following values:

  • userIdType: User’s database ID

  • userEmailType: User’s Email address

  • userExternalIdType: User’s ID in an external authentication service such as LDAP or Active Directory

I tried in Postman and can't gte it to work. Has anyone every tried this?

Anyone know if there is a alfresco-js-api "feature" for this?

Thanks

Paul

Highlighted
Partner

Re: List a users tasks using alfresco-js-api

Ahhh, so the postman issue is resolved - stupid typo on my part.

However, that does mean if you get the user credentials wrong then it returns all the tasks for the current logged in user rather then an error or no tasks....not exactly very useful.

 

Paul