Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-20180

REST API /enterprise/tasks/query does not render variables in 'task representation'

    Details

    • Bug Priority:
      Category 2
    • ACT Numbers:

      00981874

      Description

      Summary

      The "POST /enterprise/task/query" documentation in "api-explorer" indicates response should contain the listed tasks' variables.

      References:

      {
        "data": [
          {
            "adhocTaskCanBeReassigned": true,
            "assignee": {
              "company": "string",
              "email": "string",
              "externalId": "string",
              "firstName": "string",
              "id": 0,
              "lastName": "string",
              "pictureId": 0
            },
            "category": "string",
            "created": "2018-11-16T18:09:56.249Z",
            "description": "string",
            "dueDate": "2018-11-16T18:09:56.249Z",
            "duration": 0,
            "endDate": "2018-11-16T18:09:56.249Z",
            "executionId": "string",
            "formKey": "string",
            "id": "string",
            "initiatorCanCompleteTask": true,
            "involvedGroups": [
              {
                "externalId": "string",
                "groups": [
                  {}
                ],
                "id": 0,
                "name": "string",
                "status": "string"
              }
            ],
            "involvedPeople": [
              {
                "company": "string",
                "email": "string",
                "externalId": "string",
                "firstName": "string",
                "id": 0,
                "lastName": "string",
                "pictureId": 0
              }
            ],
            "managerOfCandidateGroup": true,
            "memberOfCandidateGroup": true,
            "memberOfCandidateUsers": true,
            "name": "string",
            "parentTaskId": "string",
            "parentTaskName": "string",
            "priority": 0,
            "processDefinitionCategory": "string",
            "processDefinitionDeploymentId": "string",
            "processDefinitionDescription": "string",
            "processDefinitionId": "string",
            "processDefinitionKey": "string",
            "processDefinitionName": "string",
            "processDefinitionVersion": 0,
            "processInstanceId": "string",
            "processInstanceName": "string",
            "processInstanceStartUserId": "string",
            "taskDefinitionKey": "string",
            "variables": [
              {
                "name": "string",
                "scope": "string",
                "type": "string",
                "value": {}
              }
            ]
          }
        ],
        "size": 0,
        "start": 0,
        "total": 0
      }
      

      This response representation is inconsistent with actual task representation.
      There are not variables rendered.

      Replication Steps

      • create APP with basic process (start > user task > end) and publish it with process
      • start process instance
      • use the REST API and add a "local" variable to the user task
        POST http://localhost:9999/activiti-app/api/enterprise/tasks/107520/variables
        [
          {
            "name": "tasktestvar2",
            "scope": "local",
            "type": "string",
            "value": "toastysnoot"
          }
        ]
        

      Response (200):

      [
        {
          "name": "tasktestvar2",
          "type": "string",
          "value": "toastysnoot",
          "scope": "local"
        }
      ]
      
      • Use the REST API to query for list of tasks
        POST http://localhost:9999/activiti-app/api/enterprise/tasks/query
        {
          "taskId":107520
        }
        

      Response (200)

      {
        "size": 1,
        "total": 1,
        "start": 0,
        "data": [
          {
            "id": "107520",
            "name": "Task With Variables",
            "description": null,
            "category": "snicker",
            "assignee": {
              "id": 1003,
              "firstName": "Warden1",
              "lastName": "JailBird",
              "email": "warden1.jailbird@foo.com",
              "externalId": "warden1"
            },
            "created": "2018-11-16T18:04:10.536+0000",
            "dueDate": null,
            "endDate": null,
            "duration": null,
            "priority": 100,
            "parentTaskId": null,
            "parentTaskName": null,
            "processInstanceId": "107515",
            "processInstanceName": null,
            "processDefinitionId": "TaskMeVariables:2:107514",
            "processDefinitionName": null,
            "processDefinitionDescription": null,
            "processDefinitionKey": null,
            "processDefinitionCategory": null,
            "processDefinitionVersion": 0,
            "processDefinitionDeploymentId": null,
            "formKey": null,
            "processInstanceStartUserId": null,
            "initiatorCanCompleteTask": false,
            "adhocTaskCanBeReassigned": false,
            "taskDefinitionKey": "taskvar",
            "executionId": "107515",
            "memberOfCandidateGroup": false,
            "memberOfCandidateUsers": false,
            "managerOfCandidateGroup": false
          }
        ]
      }
      

      Actual Behavior

      • POST task query response 'task representations' do not list task's variables

      Expected Behavior

      • POST task query response 'task representations' should list task's variables as per the api-explorer document example

      Workaround

      • For each task in the list, you can use the GET task variable REST API call to get local, global or both types variables for each task
        GET http://<host>:<port>/activiti-app/api/enterprise/tasks/<taskid>/variables?scope=local 
        

      ref:
      (api-explorer) http://localhost:9999/activiti-app/api-explorer.html#!/task-variables/getVariablesUsingGET
      (docs) https://docs.alfresco.com/process-services1.9/topics/task_variables.html

      Additional Information

      • There are local and global variables, if variables are to be rendered per task representation this could be excessive if the global variables (proc var) are also listed.
      • /activiti-bpm-suite/activiti-app-logic/src/main/java/com/activiti/service/runtime/AlfrescoTaskQueryService.java (line 107 listTasks)
      • /activiti-bpm-suite/activiti-app-model/src/main/java/com/activiti/model/runtime/dto/TaskQueryRepresentation.java
      • /activiti-bpm-suite/activiti-app-model/src/main/java/com/activiti/model/runtime/TaskRepresentation.java

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  djohnson Doug Johnson
                  Reporter:
                  jsoria Jennie Soria
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:

                    Structure Helper Panel