The processVariableValue filter only woks with history level FULL as it joins on the ACT_HI_DETAIL table (but it should join on the ACT_HI_VARINST table),
YOu can easily check that by adding a process variable to the existing test cases (or add a new one of course ):
public class HistoricTaskInstanceTest extends PluggableProcessEngineTestCase {
@Deployment
public void testHistoricTaskInstance() throws Exception {
Map<String, Object> variables = new HashMap<String, Object>();
>> variables.put("hallo", "steffen");
String processInstanceId = runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest", variables).getId();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
// Set priority to non-default value
Task runtimeTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
runtimeTask.setPriority(1234);
// Set due-date
Date dueDate = sdf.parse("01/02/2003 04:05:06");
runtimeTask.setDueDate(dueDate);
taskService.saveTask(runtimeTask);
String taskId = runtimeTask.getId();
String taskDefinitionKey = runtimeTask.getTaskDefinitionKey();
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery()
>> .processVariableValueEquals("test", "steffen")
.singleResult();
>> now historicTaskInstance is null
Problem in HistoricTaskInstance.xml:
<foreach collection="variables" index="index" item="var">
and exists (
select HD.ID_
>> from ${prefix}ACT_HI_DETAIL HD