How to get the active User Task of a Process Instance

For my Simulations I am looking for the active UserTask of a Process Instance.

In Camunda 8, this seems to be hard to achieve.

The tasks Query of the Tasklist API only supports these fields:

type TaskQuery {
  state: TaskState
  assigned: Boolean
  assignee: String
  candidateGroup: String
  pageSize: Int
  taskDefinitionId: String
  searchAfter: [String!]
  searchAfterOrEqual: [String!]
  searchBefore: [String!]
  searchBeforeOrEqual: [String!]
}

I also tried the Flow node instance of the Operate API - turns out the id is different to the User Task Id of the Tasklist (by +1 difference :wink:)

Any Ideas?

2 Likes

+1, this is currently way too complicated to do.

We ended up having to do the same thing - retrieve the task from the Operate API and then increment the returned key by one which we then use to query the Tasklist API. Feels super “hacky”.

Edit: Incrementing with 1 is not reliable, sometimes the task ID will be the same as the returned key, other times it’s +2 etc…

Hi @Brynvald
I made a feature request, which is now in the backlog. So in the future this will be possible :partying_face:.

2 Likes

Hello, do we have some feedback on this feature ?
I think since the task completion update the process instance there must be a link between the Task and the ProcessInstance (the problem is that link is currently not exposed in the API Task object)

Hi, any update on this topic ? heavily needed.

Sorry, I asked Camunda in the Ticket but got no response so far. As soon as I have an answer I will share.

Hi @g.manzano , @GLE
ok, here the answer from Camunda:

we plan to work on this topic this quarter, allowing you to retrieve user tasks based on both process definition and/or process instance ID by providing it in the TaskQuery filters.

Hope that is soon enough for you :slightly_smiling_face:

3 Likes

Thanks for the update ! @pme123