Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-14351

Return top-level decision instance id in evaluation result

    • Icon: Feature Request Feature Request
    • Resolution: Duplicate
    • Icon: L3 - Default L3 - Default
    • None
    • None
    • dmn-engine

      User Story (Required on creation):

      After evaluating a decision definition via API (Java or REST), I want to find all decision instances that were involved in creating the result of the evaluation. Since all involved elements are connected by a root decision instance ID, I want to receive this ID together with the evaluation result to allow querying with this later on.

      Functional Requirements (Required before implementation):

      • Receive an identifier in the evaluation result that allows searching for all involved decision instances

      Technical Requirements (Required before implementation):

      • Return a unique id in the decision evaluation result that is attached to all involved decision instances - the rootDecisionInstanceId of the historic decision instance events looks like a suitable candidate here.

      Limitations of Scope (Optional):

      • This will only work when an appropriate history level is set in the engine configuration

      Hints (optional):

      • By returning the rootDecisionInstanceId, we can reuse the historic decision instance search with a rootDecisionInstanceId parameter to find all involved elements.

        This is the controller panel for Smart Panels app

            [CAM-14351] Return top-level decision instance id in evaluation result

            Doug Gilmour created issue -
            Tobias Metzke-Bernstein made changes -
            Assignee New: Tobias Metzke-Bernstein [ tobias.metzke ]
            Tobias Metzke-Bernstein made changes -
            Link New: This issue is related to CAMTEAM-221 [ CAMTEAM-221 ]

            Hi dgilmour22,

            thanks for your proposal!

            We will have a look at it as soon as possible and update the ticket with any feedback we have.

            Best,
            Tobias

            Tobias Metzke-Bernstein added a comment - Hi dgilmour22 , thanks for your proposal! We will have a look at it as soon as possible and update the ticket with any feedback we have. Best, Tobias
            Tobias Metzke-Bernstein made changes -
            Mentioned Roles
            Tobias Metzke-Bernstein made changes -
            Mentioned Groups

            Hi dgilmour22,

            thanks again for your proposal. In order to determine how we can best help you here, please provide the following:

            • A description of the results you currently receive for which API call
            • How you would like to see this information being enhanced by further data
            • How you would use this new data in follow-up API calls you currently cannot perform due to missing data

            This will help us in determining if this information is not already available elsewhere or can be retrieved already with an existing method.
            Also,

            Thanks and best,
            Tobias

            Tobias Metzke-Bernstein added a comment - Hi dgilmour22 , thanks again for your proposal. In order to determine how we can best help you here, please provide the following: A description of the results you currently receive for which API call How you would like to see this information being enhanced by further data How you would use this new data in follow-up API calls you currently cannot perform due to missing data This will help us in determining if this information is not already available elsewhere or can be retrieved already with an existing method. Also, Thanks and best, Tobias
            Tobias Metzke-Bernstein made changes -
            Mentioned Roles
            Tobias Metzke-Bernstein made changes -
            Mentioned Groups
            Doug Gilmour made changes -
            Description Original: h3. User Story (Required on creation):

            As a developer, I need the root DecisionInstanceId returned to me when I request an evaluation of a decision-instance through the api (Java or REST) so that I can store that information in my application for later use in pulling historical information on the decision through the History API using the rootDecisionInstanceId query parameter
            h3. Functional Requirements (Required before implementation):
            h3. Technical Requirements (Required before implementation):
            h3. Limitations of Scope (Optional):
            h3. Hints (optional):
            New: h3. User Story (Required on creation):

            As a developer, I need the root DecisionInstanceId returned to me when I request an evaluation of a decision-instance through the api (Java or REST) so that I can store that information in my application for later use in pulling historical information on the decision through the History API using the rootDecisionInstanceId query parameter
            h3. Functional Requirements (Required before implementation):

            Currently the REST API  {\{baseUrl}}/decision-definition/key/:id/evaluate returns the following:
            [
                {
                    "result": {
                        "type": "String",
                        "value": "management",
                        "valueInfo": {}
                    }
                }
            ]
            What needs to be returned is 
            [
                {
                    "rootDecisionInstanceId": "4bff743a-989e-11ec-84e8-5065f3453a1b",
                    "result": {
                        "type": "String",
                        "value": "management",
                        "valueInfo": {}
                    }
                }
            ]
             
            I can store the rootDecisionInstanceID in my application so that when I need to interrogate how the decision was made from the application (to present the information to the user in the UI)...
             
            Then I can use that Root Decision Instance ID in the History API like this..
             
            {\{baseUrl}}/history/decision-instance?includeInputs=true&includeOutputs=true&rootDecisionInstanceId=4bff743a-989e-11ec-84e8-5065f3453a1b
             
            Which will return the details of the decision:
            [
                {
                    "id": "4bff743a-989e-11ec-84e8-5065f3453a1b",
                    "decisionDefinitionId": "invoice-assign-approver:2:911c7a4e-8826-11ec-923c-5065f3453a1b",
                    "decisionDefinitionKey": "invoice-assign-approver",
                    "decisionDefinitionName": "Assign Approver Group",
                    "evaluationTime": "2022-02-28T07:56:58.893-0600",
                    "removalTime": null,
                    "processDefinitionId": null,
                    "processDefinitionKey": null,
                    "processInstanceId": null,
                    "rootProcessInstanceId": null,
                    "caseDefinitionId": null,
                    "caseDefinitionKey": null,
                    "caseInstanceId": null,
                    "activityId": null,
                    "activityInstanceId": null,
                    "userId": null,
                    "inputs": [
                        {
                            "type": "String",
                            "value": "budget",
                            "valueInfo": {},
                            "id": "4bff9b4b-989e-11ec-84e8-5065f3453a1b",
                            "decisionInstanceId": "4bff743a-989e-11ec-84e8-5065f3453a1b",
                            "clauseId": "InputClause_0og2hn3",
                            "clauseName": "Invoice Classification",
                            "errorMessage": null,
                            "createTime": "2022-02-28T07:56:58.893-0600",
                            "removalTime": null,
                            "rootProcessInstanceId": null
                        }
                    ],
                    "outputs": [
                        {
                            "type": "String",
                            "value": "management",
                            "valueInfo": {},
                            "id": "4bff9b4c-989e-11ec-84e8-5065f3453a1b",
                            "decisionInstanceId": "4bff743a-989e-11ec-84e8-5065f3453a1b",
                            "clauseId": "OutputClause_1cthd0w",
                            "clauseName": "Approver Group",
                            "ruleId": "row-49839158-5",
                            "ruleOrder": 1,
                            "variableName": "result",
                            "errorMessage": null,
                            "createTime": "2022-02-28T07:56:58.893-0600",
                            "removalTime": null,
                            "rootProcessInstanceId": null
                        }
                    ],
                    "collectResultValue": null,
                    "rootDecisionInstanceId": null,
                    "decisionRequirementsDefinitionId": "invoiceBusinessDecisions:2:911c533c-8826-11ec-923c-5065f3453a1b",
                    "decisionRequirementsDefinitionKey": "invoiceBusinessDecisions",
                    "tenantId": null
                },
                {
                    "id": "4bff9b4d-989e-11ec-84e8-5065f3453a1b",
                    "decisionDefinitionId": "invoiceClassification:2:911c533d-8826-11ec-923c-5065f3453a1b",
                    "decisionDefinitionKey": "invoiceClassification",
                    "decisionDefinitionName": "Invoice Classification",
                    "evaluationTime": "2022-02-28T07:56:58.893-0600",
                    "removalTime": null,
                    "processDefinitionId": null,
                    "processDefinitionKey": null,
                    "processInstanceId": null,
                    "rootProcessInstanceId": null,
                    "caseDefinitionId": null,
                    "caseDefinitionKey": null,
                    "caseInstanceId": null,
                    "activityId": null,
                    "activityInstanceId": null,
                    "userId": null,
                    "inputs": [
                        {
                            "type": "String",
                            "value": "Misc",
                            "valueInfo": {},
                            "id": "4bff9b4f-989e-11ec-84e8-5065f3453a1b",
                            "decisionInstanceId": "4bff9b4d-989e-11ec-84e8-5065f3453a1b",
                            "clauseId": "InputClause_15qmk0v",
                            "clauseName": "Invoice Category",
                            "errorMessage": null,
                            "createTime": "2022-02-28T07:56:58.893-0600",
                            "removalTime": null,
                            "rootProcessInstanceId": null
                        },
                        {
                            "type": "Double",
                            "value": 600.0,
                            "valueInfo": {},
                            "id": "4bff9b4e-989e-11ec-84e8-5065f3453a1b",
                            "decisionInstanceId": "4bff9b4d-989e-11ec-84e8-5065f3453a1b",
                            "clauseId": "clause1",
                            "clauseName": "Invoice Amount",
                            "errorMessage": null,
                            "createTime": "2022-02-28T07:56:58.893-0600",
                            "removalTime": null,
                            "rootProcessInstanceId": null
                        }
                    ],
                    "outputs": [
                        {
                            "type": "String",
                            "value": "budget",
                            "valueInfo": {},
                            "id": "4bff9b50-989e-11ec-84e8-5065f3453a1b",
                            "decisionInstanceId": "4bff9b4d-989e-11ec-84e8-5065f3453a1b",
                            "clauseId": "clause3",
                            "clauseName": "Classification",
                            "ruleId": "DecisionRule_1ak4z14",
                            "ruleOrder": 1,
                            "variableName": "invoiceClassification",
                            "errorMessage": null,
                            "createTime": "2022-02-28T07:56:58.893-0600",
                            "removalTime": null,
                            "rootProcessInstanceId": null
                        }
                    ],
                    "collectResultValue": null,
                    "rootDecisionInstanceId": "4bff743a-989e-11ec-84e8-5065f3453a1b",
                    "decisionRequirementsDefinitionId": "invoiceBusinessDecisions:2:911c533c-8826-11ec-923c-5065f3453a1b",
                    "decisionRequirementsDefinitionKey": "invoiceBusinessDecisions",
                    "tenantId": null
                }
            ]
            h3. Technical Requirements (Required before implementation):
            h3. Limitations of Scope (Optional):
            h3. Hints (optional):
            Doug Gilmour made changes -
            Mentioned Roles

              Unassigned Unassigned
              dgilmour22 Doug Gilmour
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: