Is it possible to GET task list which is sorted by a processVariable?
Overview of our problem, we have multiple process instances, each with a distinct payload(JSON), the payload is stored as a process variable. the process instance have tasks, trying to retrieve highest priority task across all process instances, the priority is determined by properties inside the payload.
So we decided to create a sortString which is a concatenation of the properties inside the payload(JSON) and attach it as processVariable. Now we are looking for a way to sort based on that sortString.
Hi @Tapan, as far I know, using APIs is not possible to sort by a variable content.
So my suggestion is to get all task, and use an external script to sort it.
Hey @Ingo_Richtsmeier,
In the link attached we see tasks can be filtered based on processVariables via the query parameter
processVariables : ‘key_operator_value’
but can’t find the sorting option. could you point us in the right direction.
Thanks
Hi all,
I couldn’t find a direct way to GET the sorted task list using Camunda REST Api with the query parameters. However the following code snippet (from Camunda Spring-Boot but could be any other Camunda deployment) gives you the task list in the desired order:
sortBy Mandatory. Sort the results lexicographically by a given criterion. Valid values are instanceId , caseInstanceId , dueDate , executionId , caseExecutionId , assignee , created , description , id , name , nameCaseInsensitive , priority , processVariable , executionVariable , taskVariable , caseExecutionVariable , and caseInstanceVariable .
parameters Mandatory when sortBy is either processVariable , executionVariable , taskVariable , caseExecutionVariable , or caseInstanceVariable . Must be a JSON object with the properties variable and type where variable is a variable name and type is the name of a variable value type.