Process instance filtering

Hi,

I want to add some filters to running process instances list and I can’t find a way for some of them.
I would appreciate it if you could give some advice on any of them.

  • process instances that their active tasks’ due date is passed.
  • by created date ( I don’t understand why it is not present in rest API )
  • by assignee
  • process instances that their current steps is a user task.

Thanks

Hi @dooghi,

You can use Camunda native query API to create such filters.

Below is an example of a native process instance query.
runtimeService.createNativeProcessInstanceQuery().sql("SELECT * FROM " + managementService.getTableName(ProcessInstance.class)).list()

You can join with Task table to get the intended results

Below is another example of a native task query
https://camunda.com/best-practices/enhancing-tasklists-with-business-data/#using-the-camunda-bpm-native-query-api

Also, you can embed Camunda REST API in a custom JAX-RS application. (to extend it)

1 Like

Thank you @hassang,
Very insightful,
For using Camunda native query API, should I use an embedded engine model? Because I integrated my application with Camunda via Rest APIs, so I don’t have access to Camunda libraries. If yes, Is there any equivalent mapping in Rest APIs to use?

About extending Camunda Rest APIs, If I understand correctly, I have to add another application to embed the engine in that application and expose another REST API to use in my main application. Am I right? Did you see any samples for it?

Thanks,

I will appreciate it if anyone have an idea about how to do it without embedding engine in our application. We integrate with engine just with Rest APIs and external tasks.
Thanks