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

Hi, what is the update of this features? is this ready to use already?

Thanks.

Hi @Jenneffer_Jiminit sorry I have no update on my Camunda Ticket. And also in the Release Notes of 8.2 there is nothing like this: Release Camunda Platform 8.2.2 · camunda/camunda-platform · GitHub

Ok, despite there is nothing in the release notes it should be added to 8.2 in April.

As I am not working with Camunda 8 at the moment, can somebody let us know if it is working as you expected?

@Jenneffer_Jiminit, @g.manzano, and @GLE - this feature was added to the API. You can now query tasks using a process instance ID with both the GraphQL and REST APIs. Hope that helps! Please let me know if you have any questions or issues!

3 Likes