Java API - Get Instances sort by variables

Hi Camunda Community,

I would like to know that how to get process Instances with sort by Process Variables.

I tried and find I can order by

businessKey, processDefinationKey InstanceId and TenantId using ProcessInstanceQuery.

Similarly I can get all task by tenantId with sorting with process variable using

TaskQuery -- orderByProcessVariable 

Any idea how to get the Process Instance with sorting by process variables?

Thanks & Regards

Hi, did you find a solution?

We are having the same issue here: get a list of historical process instances sorted by the value of a specific variable (the name of the variable to sort by can vary). This should be the same as with “normal” process instances.

I have read about the possibility of creating a custom query but I cannot find the correct way to implement that and get it working in the Camunda engine and have it mapped to a REST-Url.