[MNT-20180] REST API /enterprise/tasks/query does not render variables in 'task representation' Created: 16-Nov-18  Updated: 08-May-20  Resolved: 01-Apr-20

Status: Closed
Project: Service Packs and Hot Fixes
Component/s: APS REST API
Affects Version/s: Alfresco Process Services 1.9.0.3
Fix Version/s: Alfresco Process Services 1.11

Type: Service Pack Request
Reporter: Jennie Soria [X] (Inactive) Assignee: Closed Bugs (Inactive)
Resolution: Fixed Votes: 1
Labels: triaged_Jul2019
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

APS 1.9.0.3


Issue Links:
Related
relates to MNT-19944 Enterprise REST api call 'api/enterpr... Open
Shadow
Bug Priority:
Category 2
ACT Numbers:

00981874, 00996943

Epic Link: PAD - APS Customer Requests
Delivery Team: APS

 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


 Comments   
Comment by Mark Howarth [X] (Inactive) [ 01-Apr-20 ]

Fixed in release APS 1.11, released 31st March 2020

Generated at Sun Mar 07 18:41:45 GMT 2021 using Jira 7.13.15#713015-sha1:7c5ddd2c3e1709974ae9c48c17df8edd3919fe2c.