Cannot query GraphQL API for tasks by processInstanceId in versions prior to 8.1.7

Vlad Bulimac: hi all. I’m running camunda self managed v8.1.6 and trying to get a list of active tasks by processInstanceId using tasklist graphql api and i get the following error

[GraphQLError(message=Validation error of type WrongType: argument 'query' with value 'ObjectValue{objectFields=[ObjectField{name='state', value=EnumValue{name='CREATED'}}, ObjectField{name='processInstanceId', value=StringValue{value='2251799816869227'}}]}' contains a field not in 'TaskQuery': 'processInstanceId' @ 'tasks', path=[], locations=[{line=2, column=9}], extensions=GraphQLErrorExtensions(errorType=null, errorDetail=null, origin=, debugInfo=GraphQLErrorDebugInfo(subquery=, variables={}), classification=ValidationError))]

the query i’m trying

query {\n  tasks(query: {state : CREATED, processInstanceId : \"2251799816869227\"}) {\n    id\n    name\n    processName\n    assignee\n    candidateGroups\n    formKey\n    taskState\n    variables {\n      name\n      value\n      isValueTruncated\n    }\n  }\n}

as far as i can see in the documentation for v8.1 https://docs.camunda.io/docs/8.1/apis-tools/tasklist-api/inputs/task-query/|here this should be a valid query. am i missing something? has anyone faced this issue before?

Josh Wulf: Yeah, that doesn’t work.

Josh Wulf: In implementing the Node.js API client, I discovered that this doesn’t work.

I can’t remember where it got documented.

You basically have to pull all the created tasks and filter by process instance Id

Vlad Bulimac: Wondering if it works in camunda 8.2. Retrieving all active tasks and filter them might be a costly operation for me. Also any idea if specifying the processInstanceId of the parent process will find the tasks from child processes - e.g. call activities started by the parent process?

Marcos Vieira: hi <@U03TENKERCK>, the processInstanceId filter was fixed on version 8.1.7 or any version above… I did the test also with 8.2 version and filtering by processInstanceId worked fine…

<@UT1BZ1GAG> did you get this error in recent versions or in the past, just checking if we need to review this again

Josh Wulf: It was in the past. Good to know that it was fixed, and the fix version.

Note: This post was generated by Slack Archivist from a conversation in the Camunda Platform 8 Slack, a source of valuable discussions on Camunda 8 (join here). Someone in the Slack thought this was worth sharing!

If this post answered a question for you, hit the Like button - we use that to assess which posts to put into docs.