Is using this named sql query - getProcessInstancesByVariableNameAndValue -
Due to the specific usage of 'max' aggregate function it functions only when one process variable is present in the given process instance.
Imagine following content of VariableInstanceLog table:
If you call this:
It will return empty response, because the SQL query which has run behind the scene filtered variable with id '52' and only included id '53', so it's possible to successfully query var2 and not var1.
I managed to workaround this issue by replacing Servicesorm.xml file like this:
Not submitting PR since there may be more effective way to fix this.