Sorting Historic Task Instances based on Process Variables

I was referring this Get Tasks (Historic) (POST) docs for sorting the process variables.

I found there’s restriction on fields for sorting.

Is that possible to do the sorting based on process variables?

I found sorting can be done on process variables from the ticket @thorben updated.

https://app.camunda.com/jira/browse/CAM-2661

Is this still possible in camunda 7.10 to sort the historic task instances based on process variables?

"sorting":[
    {
      "sortBy": "dueDate",
      "sortOrder": "asc"
    },
    {
       "sortBy": "processVariable",
       "sortOrder": "desc",
       "parameters": {
          "variable": "orderId",
          "type": "String"
    }}]

If possible can include this sorting functionality based on process variable in historic task instances?

Requirement for this Rest Api: Get Tasks (Historic) (POST) | docs.camunda.org

@thorben @nikola.koevski @felix-mueller @Philipp_Ossler

If possible please include in upcoming camunda release.

image

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

0 voters

Hi @aravindhrs,

This sounds generally like a useful addition to the API. A question that needs clarification is that a straight-forward implementation would not take time into account (i.e. you would sort the tasks by variables, even if the variable value was set after the task was completed). I think the implementation becomes much more complex when it should take time into account (i.e. sort by the values that were valid when the task was last updated).

While it is an interesting addition, we will likely not implement this in the core team in the near- or mid-term future, as we have a full roadmap and a lot of other responsibilities. We would welcome a contribution, though.

Cheers,
Thorben

HI @aravindhrs

besides Thorbens answer I would be interested in the use cases - especially the Historic Task API. What are you actually trying to achieve? How do you use the engine?

Best
Felix

Hi @felix-mueller, i was using camunda spring boot starters. Its totally Rest Api call to camunda engine.

Our requirement is, we want to sort the historic task instances based on process variables.

Already task instances has sorting based on process/task variables. Same sorting behavior we are expecting in historic task instances.

1 Like

Hi Aravind
Can we sort tasks based on taskVariables? I did not see that in TaskQuery or HistoricTaskQuery documentation…