.setVariable("anotherVariableName", "xyz")
.create();
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
query
.caseInstanceIdIn(instance1.getId(), instance2.getId())
.orderByVariableName()
.asc();
List<VariableInstance> result = query.list();