Query tasks

Hi, I have a functionality, where I need to select all tasks for candidate user A, which are assigned to anyone but user A.

I have been searching through the api up and down and did not find a way to do this.

Have I overlooked something or do I really need to write custom query for every attribute, that already is in the standard API,but I would need to use negation/complement.

Hi @tomorrow

I think you can try using Native Queries

https://docs.camunda.org/manual/7.6/user-guide/process-engine/process-engine-api/#native-queries

This requires some knowledge about the internal data structure

https://docs.camunda.org/manual/7.5/user-guide/process-engine/database/

Thank you, but native query is unfortunately basically custom query, but only for on type of DB.

However, these words really suggest, there is no other way.

Sometimes you need more powerful queries, e.g., queries using an OR operator or restrictions you can not express using the Query API. For these cases, we introduced native queries, which allow you to write your own SQL queries.

The problem is, that I need to have the possibility to use also other parameters from TaskQuery, when needed, to specify the data even further. So if I ended up writing my own custom select, I would base it on the standard select and only define my own property on top. And then, eventually there would be many such custom queries with C&P code, which and some future change in camunda DB model could get me some worries.