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

Enterprise REST api call 'api/enterprise/process-instances/query' does not recognize 'includeProcessVariables' parameter prevent rendering list of variables

    Details

    • Bug Priority:
      Category 1
    • ACT Numbers:

      00971036

      Description

      Issue seems related to ACTIVITI-355 where the historic process instance query now supports “includeProcessVariables”, but the normal process instance query API (/api/enterprise/process-instances/query) does not, whereas it does support the parameter in the corresponding engine API call (/api/query/process-instances). The customer has no way to display a list of process variables when running Enterprise REST call /api/enterprise/process-instances/query

      Steps to reproduce

      1. Login to activiti-admin, select the Instances tab and locate a running process instance, which contains at least 1 process instance variable. Copy the process instance id. e.g. 2506. NOTE: If you can´t locate a running instance with a process variable, you would have to start any process and could add a process variable via activiti-admin
      2. Open POSTMAN (or any RESTful client) and fire below calls:
      3. Enterprise API call get list of process-instances -> /api/enterprise/process-instances/query

      (a) Without specifying the “includeProcessVariables” parameter in request body, empty variables bracket will be returned.
      Request

      POST  http://localhost:8080/activiti-app/api/enterprise/process-instances/query
      {
          "processInstanceId":"2506"
      }
      

      Response

      {
          "size": 1,
          "total": 1,
          "start": 0,
          "data": [
              {
                  "id": "2506",
                  "name": "myprocess",
                  "businessKey": null,
                  "processDefinitionId": "testProcesWorkspace:1:4",
                  "tenantId": "tenant_1",
                  "started": "2018-06-26T14:26:56.632+0000",
                  "ended": null,
                  "startedBy": {
                      "id": 1,
                      "firstName": null,
                      "lastName": "Administrator",
                      "email": "admin@app.activiti.com"
                  },
                  "processDefinitionName": "testProcesWorkspace",
                  "processDefinitionDescription": null,
                  "processDefinitionKey": "testProcesWorkspace",
                  "processDefinitionCategory": "http://www.activiti.org/processdef",
                  "processDefinitionVersion": 1,
                  "processDefinitionDeploymentId": "1",
                  "graphicalNotationDefined": true,
                  "startFormDefined": false,
                  "suspended": false,
                  "variables": [ ]
      }
      

      (b) If attempting to specify “includeProcessVariables” parameter in the request body, it results in an error "JSON parse error: Unrecognized field \"includeProcessVariables\""

      Request

      POST  http://localhost:8080/activiti-app/api/enterprise/process-instances/query
      {
          "processInstanceId":"2506",
          "includeProcessVariables":"true"
      }
      

      Response

      {
          "message": "JSON parse error: Unrecognized field \"includeProcessVariables\" (class com.activiti.model.runtime.dto.ProcessInstanceQueryRepresentation), not marked as ignorable; nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field \"includeProcessVariables\" (class com.activiti.model.runtime.dto.ProcessInstanceQueryRepresentation), not marked as ignorable (8 known properties: \"size\", \"start\", \"processDefinitionId\", \"sort\", \"page\", \"state\", \"processInstanceId\", \"appDefinitionId\"])\n at [Source: (PushbackInputStream); line: 3, column: 32] (through reference chain: com.activiti.model.runtime.dto.ProcessInstanceQueryRepresentation[\"includeProcessVariables\"])",
          "messageKey": "GENERAL.ERROR.BAD-REQUEST"
      }
      

      c) however, running the equivalent Engine API call allows querying for process-instances with the "includeProcessVariables" parameter in the request body and returns instances including their variables.
      Request

      POST http://localhost:8080/activiti-app/api/query/process-instances
      {
          "processInstanceId":"2506",
          "includeProcessVariables":"true"
      }
      

      Response

      {
          "size": 1,
          "total": 1,
          "start": 0,
          "data": [
              {
                  "id": "2506",
                  "name": "myprocess",
                  "businessKey": null,
                  "processDefinitionId": "testProcesWorkspace:1:4",
                  "tenantId": "tenant_1",
                  "started": "2018-06-26T14:26:56.632+0000",
                  "ended": null,
                  "startedBy": {
                      "id": 1,
                      "firstName": null,
                      "lastName": "Administrator",
                      "email": "admin@app.activiti.com"
                  },
                  "processDefinitionName": "testProcesWorkspace",
                  "processDefinitionDescription": null,
                  "processDefinitionKey": "testProcesWorkspace",
                  "processDefinitionCategory": "http://www.activiti.org/processdef",
                  "processDefinitionVersion": 1,
                  "processDefinitionDeploymentId": "1",
                  "graphicalNotationDefined": true,
                  "startFormDefined": false,
                  "suspended": false,
                  "variables": [
              {
                  "name": "initiator",
                  "type": "string",
                  "value": "1"
              },
              {
                  "name": "contractNodeEntry",
                  "type": "string",
                  "value": "test"
              }
          ]
      }
      

      Expected Behavior
      Variables are listed in the response similar to a historic query 'api/enterprise/historic-process-instances/query' using the "includeProcessVariables" parameter set to "true" in the query request body.

      Actual Behavior
      Process Variables are never listed in the 'api/enterprise/process-instances/query' call response and the "includeProcessVariables" parameter is an unrecognized field.

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  apsteam APS Team
                  Reporter:
                  sliaw Seng Liaw
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:

                    Structure Helper Panel