AnsweredAssumed Answered

query/tasks in activiti rest api not giving desired results

Question asked by vickysirwani on Jul 27, 2014
Latest reply on Jul 29, 2014 by frederikheremans1
I have attached a bpmn file and the two files being used in Java Service Tasks.
I start the process and set the form property f1 to asd.
Then I hit the query/tasks rest api with the following body:
{
    "assignee": "kermit",
    "taskDefinitionKey": "ut2",
    "processInstanceVariables": [
         {
      "name": "questionnaire",
      "type": "string",
      "value": "asd",
        "operation":"equals"
      }   
     ]

}

I get the following result:
{
    "data": [
        {
            "id": "25093",
            "url": "http://xxxxxx/service/runtime/tasks/25093",
            "owner": null,
            "assignee": "kermit",
            "delegationState": null,
            "name": "UT2",
            "description": null,
            "createTime": "2014-07-27T17:17:36.257+0000",
            "dueDate": null,
            "priority": 50,
            "suspended": false,
            "taskDefinitionKey": "ut2",
            "tenantId": "",
            "category": null,
            "parentTaskId": null,
            "parentTaskUrl": null,
            "executionId": "25085",
            "executionUrl": "http://xxxxxx/service/runtime/executions/25085",
            "processInstanceId": "25068",
            "processInstanceUrl": "http://xxxxxx/service/runtime/process-instances/25068",
            "processDefinitionId": "myProcess:1:25067",
            "processDefinitionUrl": "http://xxxxxx/service/repository/process-definitions/myProcess%3A1%3A25067",
            "variables": []
        },
        {
            "id": "25098",
            "url": "http://xxxxxx/service/runtime/tasks/25098",
            "owner": null,
            "assignee": "kermit",
            "delegationState": null,
            "name": "UT2",
            "description": null,
            "createTime": "2014-07-27T17:17:36.259+0000",
            "dueDate": null,
            "priority": 50,
            "suspended": false,
            "taskDefinitionKey": "ut2",
            "tenantId": "",
            "category": null,
            "parentTaskId": null,
            "parentTaskUrl": null,
            "executionId": "25087",
            "executionUrl": "http://xxxxxx/service/runtime/executions/25087",
            "processInstanceId": "25068",
            "processInstanceUrl": "http://xxxxxx/service/runtime/process-instances/25068",
            "processDefinitionId": "myProcess:1:25067",
            "processDefinitionUrl": "http://xxxxxx/service/repository/process-definitions/myProcess%3A1%3A25067",
            "variables": []
        },
        {
            "id": "25103",
            "url": "http://xxxxxx/service/runtime/tasks/25103",
            "owner": null,
            "assignee": "kermit",
            "delegationState": null,
            "name": "UT2",
            "description": null,
            "createTime": "2014-07-27T17:17:36.262+0000",
            "dueDate": null,
            "priority": 50,
            "suspended": false,
            "taskDefinitionKey": "ut2",
            "tenantId": "",
            "category": null,
            "parentTaskId": null,
            "parentTaskUrl": null,
            "executionId": "25089",
            "executionUrl": "http://xxxxxx/service/runtime/executions/25089",
            "processInstanceId": "25068",
            "processInstanceUrl": "http://xxxxxx/service/runtime/process-instances/25068",
            "processDefinitionId": "myProcess:1:25067",
            "processDefinitionUrl": "http://xxxxxx/service/repository/process-definitions/myProcess%3A1%3A25067",
            "variables": []
        }
    ],
    "total": 3,
    "start": 0,
    "sort": "id",
    "order": "asc",
    "size": 3
}

I believe I should be getting only 1 result as I am setting the variable questionnaire as "asd" only once.

But here I am getting 3 results with taskIds: 25093, 25098 and 25103.

When I query variables of taskId 25093, I get the expected result:

[
{
name: "questionnaire",
type: "string",
value: "asd",
scope: "global"
},
{
name: "nrOfInstances",
type: "integer",
value: 3,
scope: "global"
},
{
name: "questionaireCollection",
type: "serializable",
value: null,
valueUrl: "http://xxxxxxxx/service/runtime/tasks/25093/variables/questionaireCollection/data",
scope: "global"
},
{
name: "nrOfActiveInstances",
type: "integer",
value: 3,
scope: "global"
},
{
name: "f1",
type: "string",
value: "asd",
scope: "global"
},
{
name: "nrOfCompletedInstances",
type: "integer",
value: 0,
scope: "global"
},
{
name: "loopCounter",
type: "integer",
value: 0,
scope: "global"
}
]

Also, when I query the tasks for the taskId 25098, I get expected result, the variable questionnaire set to "qwe".

Am I missing something?

Is this the expected result for query/tasks?

Outcomes