Skip to content

Run

Webapps#

In order to run the Process DMN, you can go Tasklist and Start Process. Then select the process to execute.

workflow-engine

Then set the Business Key for the process instance to be created.

Note

Business Key will be useful later to gather information about this instance and using other functionality such as sending messages. Instead of storing the internal identifier generated by Camunda (UUID) you can set a external identifier.

workflow-engine

Refresh the page F12 in order to get all pending tasks. Select the Purchase Policy task and press claim to assign the task to yourself. Fill all the values and finally press complete.

workflow-engine

Go to Cockpit and select the Process DMN deployment and the current process instance to get process information and insights. From this dashboard you can get the current state of the process: watch all variables, current task and additional information.

Enterprise Feature

Historical data is only included in the enterprise edition of Camunda 7, it is not available in the community edition.

workflow-engine

Go to Decisions, then select the Decision Table used by this process (Risk) and select the current process instance being running. In this dashboard you can see the decision made by the DMN highlighted.

workflow-engine

Finally, go to the Tasklist and complete the Escalate Approval task.

workflow-engine

In Camunda console you must see following logs by using the default values in the forms. Different values will follow different paths in the flow that means different tasks and operations are performed.

Compute Policy MID risk
[result:true, risk:MID]
An email has been sent to the user to deny the policy.

API Rest#

Admin#
Get All Users#

Request

# Get all users. You can filter users by firstName, email, emailLike, id, etc..
curl --location 'http://localhost:8080/engine-rest/user' \
--header 'Accept: application/json' \
| jq .

Response

[
    {
        "id": "admin", // (1)!
        "firstName": "Admin",
        "lastName": "Admin",
        "email": "admin@localhost"
    }
]
  1. User identifier to be used in operations such as claim task
Process#
Get All Process Definitions#

Request

# Get all process definitions. You can filter processes by active, process key, etc..
curl --location 'http://localhost:8080/engine-rest/process-definition' \
--header 'Accept: application/json' \
| jq .

Response

[
  {
    "id": "process-dmn:1:8b5fb8a9-a126-11ef-b98f-36542ecc2075",
    "key": "process-dmn", // (1)!
    "category": "http://bpmn.io/schema/bpmn",
    "description": null,
    "name": "Process DMN", // (2)!
    "version": 1, // (3)!
    "resource": "/Users/jsantosa/Projects/Github/Workflow-Engine-Example/src/workflow-engine/target/classes/workflows/examples/bpmn/process-dmn.bpmn",
    "deploymentId": "8b4ea1a0-a126-11ef-b98f-36542ecc2075",
    "diagram": null,
    "suspended": false,
    "tenantId": null,
    "versionTag": null,
    "historyTimeToLive": 180,
    "startableInTasklist": true
  },
  // more process definitions.
]
  1. The Process key that will be used to create a new Process instance.
  2. The Name of the process.
  3. The latest version of the process deployed.
Start Process Instance#

Request

# Start Process Instance. You can also send variables and other information to the process at start.
PROCESS_KEY=process-dmn
BUSINESS_KEY=1234
curl --location "http://localhost:8080/engine-rest/process-definition/key/$PROCESS_KEY/start" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "businessKey": "'"$BUSINESS_KEY"'"
}' \
| jq .

Response

{
  "links": [
    {
      "method": "GET",
      "href": "http://localhost:8080/engine-rest/process-instance/4031e4b2-a128-11ef-b98f-36542ecc2075",
      "rel": "self"
    }
  ],
  "id": "4031e4b2-a128-11ef-b98f-36542ecc2075", // (1)!
  "definitionId": "process-dmn:1:8b5fb8a9-a126-11ef-b98f-36542ecc2075",
  "businessKey": "1234", // (2)!
  "caseInstanceId": null,
  "ended": false,
  "suspended": false,
  "tenantId": null
}
  1. The internal identifier generated for the current process instance.
  2. The external identifier of the process.
Get All Process Instances#

Request

# Get all process instances. You can filter processes by processKey, definitionIDd, etc..
PROCESS_KEY=process-dmn
curl --location 'http://localhost:8080/engine-rest/process-instance?firstResult=0&maxResults=50' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "processDefinitionKey": "'"$PROCESS_KEY"'"
}' \
| jq .

Response

[
  {
    "links": [],
    "id": "3f299e33-a137-11ef-b98f-36542ecc2075", // (1)!
    "definitionId": "process-dmn:1:8b5fb8a9-a126-11ef-b98f-36542ecc2075",
    "businessKey": "1234", // (2)!
    "caseInstanceId": null,
    "ended": false,
    "suspended": false,
    "tenantId": null
  },
 // more process instances.
]
  1. The internal process instance identifier.
  2. The BusinessKey of the process.
Task#
Get All Tasks#

Request

# Get all tasks. You can filter processed by candidate groups, candidate users, business key, etc..
curl --location 'http://localhost:8080/engine-rest/task?firstResult=0&maxResults=50' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "active": "true"
}' \
| jq .

Response

[
    {
        "id": "4033e085-a128-11ef-b98f-36542ecc2075", // (1)!
        "name": "Purchase Policy", // (2)!
        "assignee": null, // (3)!
        "created": "2024-11-12T19:59:31.968+0100",
        "due": null,
        "followUp": null,
        "lastUpdated": null,
        "delegationState": null,
        "description": null,
        "executionId": "4031e4b2-a128-11ef-b98f-36542ecc2075",
        "owner": null,
        "parentTaskId": null,
        "priority": 50,
        "processDefinitionId": "process-dmn:1:8b5fb8a9-a126-11ef-b98f-36542ecc2075",
        "processInstanceId": "4031e4b2-a128-11ef-b98f-36542ecc2075",
        "taskDefinitionKey": "purchase-policy", // (4)!
        "caseExecutionId": null,
        "caseInstanceId": null,
        "caseDefinitionId": null,
        "suspended": false,
        "formKey": null,
        "camundaFormRef": { // (5)!
            "key": "purchase-policy",
            "binding": "latest",
            "version": null
        },
        "tenantId": null,
        "taskState": "Created"
    }
]
  1. The internal identifier of the task.
  2. The Name of the task.
  3. The current assignee.
  4. The task definition key used in BPMN.
  5. The form attached to this task.
Claim Task#

Note

It's not necessary to claim a task before its completion.

Request

# Claim Task. You will need to know the task id and the user id.
TASK_ID=3f29c546-a137-11ef-b98f-36542ecc2075
USER_ID=admin
curl --location "http://localhost:8080/engine-rest/task/$TASK_ID/claim" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "userId": "'"$USER_ID"'"
}' \
| jq .

Response

N/A

Get Task by Id#

Request

# Get task by id. You can filter processed by candidate groups, candidate users, business key, etc..
TASK_ID=3f29c546-a137-11ef-b98f-36542ecc2075
curl --location 'http://localhost:8080/engine-rest/task?firstResult=0&maxResults=50' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "taskId": "'"$TASK_ID"'"
}' \
| jq .

Response

[
  {
    "id": "4033e085-a128-11ef-b98f-36542ecc2075",
    "name": "Purchase Policy",
    "assignee": "admin", // (1)!
    "created": "2024-11-12T19:59:31.968+0100",
    "due": null,
    "followUp": null,
    "lastUpdated": "2024-11-12T21:10:26.298+0100",
    "delegationState": null,
    "description": null,
    "executionId": "4031e4b2-a128-11ef-b98f-36542ecc2075",
    "owner": null,
    "parentTaskId": null,
    "priority": 50,
    "processDefinitionId": "process-dmn:1:8b5fb8a9-a126-11ef-b98f-36542ecc2075",
    "processInstanceId": "4031e4b2-a128-11ef-b98f-36542ecc2075",
    "taskDefinitionKey": "purchase-policy",
    "caseExecutionId": null,
    "caseInstanceId": null,
    "caseDefinitionId": null,
    "suspended": false,
    "formKey": null,
    "camundaFormRef": {
      "key": "purchase-policy",
      "binding": "latest",
      "version": null
    },
    "tenantId": null,
    "taskState": "Updated"
  }
]
  1. Current assignee to the task. If the task was not claimed before, this value will be null.
Complete#

Purchase Policy

Request

# Complete Task
TASK_ID=3f29c546-a137-11ef-b98f-36542ecc2075
curl --location "http://localhost:8080/engine-rest/task/$TASK_ID/complete" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "variables": {
    "name": {
      "value": "MyName"
    },
    "surname": {
      "value": "MySurname"
    },
    "age": {
      "value": 24
    },
    "currentDate": {
      "value": "2024-11-20"
    },
    "type": {
      "value": "CAR"
    }
  }
}' \
| jq .

Response

N/A

Approval Escalation

Request

# Complete Task
TASK_ID=c22ce7f7-a190-11ef-b98f-36542ecc2075
curl --location "http://localhost:8080/engine-rest/task/$TASK_ID/complete" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "variables": {
    "approved": {
      "value": false
    }
  }
}' \
| jq .
Submit Form#

Purchase Policy

Request

# Submit form
TASK_ID=3f29c546-a137-11ef-b98f-36542ecc2075
curl --location "http://localhost:8080/engine-rest/task/$TASK_ID/submit-form" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "variables": {
    "name": {
      "value": "MyName"
    },
    "surname": {
      "value": "MySurname"
    },
    "age": {
      "value": 24
    },
    "currentDate": {
      "value": "2024-11-20"
    },
    "type": {
      "value": "CAR"
    }
  }
}' \
| jq .

Response

N/A

Approval Escalation

Request

# Submit form
TASK_ID=081da124-a136-11ef-b98f-36542ecc2075
curl --location "http://localhost:8080/engine-rest/task/$TASK_ID/submit-form" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "variables": {
    "approved": {
      "value": false
    }
  }
}' \
| jq .
Get Task Variables#

Task Variables

Request

# Get Task Variables (forms)
TASK_ID=308977e1-a191-11ef-b98f-36542ecc2075
curl --location "http://localhost:8080/engine-rest/task/$TASK_ID/variables?deserializeValues=true" \
--header 'Accept: application/json' \
| jq .

Response

{
  "result": {
    "type": "Object",
    "value": {
      "result": true,
      "risk": "MID"
    },
    "valueInfo": {
      "objectTypeName": "java.util.HashMap",
      "serializationDataFormat": "application/x-java-serialized-object"
    }
  },
  "surname": {
    "type": "String",
    "value": "MySurname",
    "valueInfo": {}
  },
  "name": {
    "type": "String",
    "value": "MyName",
    "valueInfo": {}
  },
  "currentDate": {
    "type": "String",
    "value": "2024-11-20",
    "valueInfo": {}
  },
  "type": {
    "type": "String",
    "value": "CAR",
    "valueInfo": {}
  },
  "age": {
    "type": "Integer",
    "value": 24,
    "valueInfo": {}
  }
}

Form Variables

Request

# Get Task Variables (forms)
TASK_ID=3dbe1f9a-a18f-11ef-b98f-36542ecc2075
curl --location "http://localhost:8080/engine-rest/task/$TASK_ID/form-variables?deserializeValues=true" \
--header 'Accept: application/json' \
| jq .

Response

{
  "result": {
    "type": "Object",
    "value": {
      "result": true,
      "risk": "MID"
    },
    "valueInfo": {
      "objectTypeName": "java.util.HashMap",
      "serializationDataFormat": "application/x-java-serialized-object"
    }
  },
  "surname": {
    "type": "String",
    "value": "MySurname",
    "valueInfo": {}
  },
  "name": {
    "type": "String",
    "value": "MyName",
    "valueInfo": {}
  },
  "currentDate": {
    "type": "String",
    "value": "2024-11-20",
    "valueInfo": {}
  },
  "type": {
    "type": "String",
    "value": "CAR",
    "valueInfo": {}
  },
  "age": {
    "type": "Integer",
    "value": 24,
    "valueInfo": {}
  }
}
Get Deployed Form#

Request

# Get Deployed Form by task id
TASK_ID=3dbe1f9a-a18f-11ef-b98f-36542ecc2075
curl --location "http://localhost:8080/engine-rest/task/$TASK_ID/deployed-form" \
--header 'Accept: application/xhtml+xml' \
| jq .

Response

{
  "components": [
    {
      "label": "Approve",
      "type": "checkbox",
      "layout": {
        "row": "Row_0a5rbmx",
        "columns": null
      },
      "id": "Field_1eatpg7",
      "key": "approved"
    }
  ],
  "type": "default",
  "id": "approval",
  "exporter": {
    "name": "Camunda Modeler",
    "version": "5.28.0"
  },
  "executionPlatform": "Camunda Platform",
  "executionPlatformVersion": "7.22.0",
  "schemaVersion": 16
}
Historical#
Process Instances#

Request

# Historical Process Instances
PROCESS_KEY=process-dmn
curl --location 'http://localhost:8080/engine-rest/history/process-instance?firstResult=0&maxResults=50' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
    "processDefinitionKey": "'"$PROCESS_KEY"'"
}' \
| jq .

Response

[
  {
    "id": "24ad1fd7-a191-11ef-b98f-36542ecc2075",
    "businessKey": "1234",
    "processDefinitionId": "process-dmn:1:8b5fb8a9-a126-11ef-b98f-36542ecc2075",
    "processDefinitionKey": "process-dmn",
    "processDefinitionName": "Process DMN",
    "processDefinitionVersion": 1,
    "startTime": "2024-11-13T08:30:22.943+0100",
    "endTime": null,
    "removalTime": null,
    "durationInMillis": null,
    "startUserId": "admin",
    "startActivityId": "StartEvent_1",
    "deleteReason": null,
    "rootProcessInstanceId": "24ad1fd7-a191-11ef-b98f-36542ecc2075",
    "superProcessInstanceId": null,
    "superCaseInstanceId": null,
    "caseInstanceId": null,
    "tenantId": null,
    "state": "ACTIVE",
    "restartedProcessInstanceId": null
  },
  // more historical data
]
Tasks#

Request

# Get task by id. You can filter processed by candidate groups, candidate users, business key, etc..
BUSINESS_KEY=1234
curl --location 'http://localhost:8080/engine-rest/history/task?firstResult=0&maxResults=50' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
  "processInstanceBusinessKey": "'"$BUSINESS_KEY"'"
}' \
| jq .

Response

[
  {
    "id": "f2c092fa-a135-11ef-b98f-36542ecc2075",
    "processDefinitionKey": "process-dmn",
    "processDefinitionId": "process-dmn:1:8b5fb8a9-a126-11ef-b98f-36542ecc2075",
    "processInstanceId": "c3adcab0-a135-11ef-b98f-36542ecc2075",
    "executionId": "f2c06be6-a135-11ef-b98f-36542ecc2075",
    "caseDefinitionKey": null,
    "caseDefinitionId": null,
    "caseInstanceId": null,
    "caseExecutionId": null,
    "activityInstanceId": "policy-approval:f2c06be7-a135-11ef-b98f-36542ecc2075",
    "name": "Approval",
    "description": null,
    "deleteReason": "deleted",
    "owner": null,
    "assignee": null,
    "startTime": "2024-11-12T21:37:34.982+0100",
    "endTime": "2024-11-12T21:38:10.818+0100",
    "duration": 35836,
    "taskDefinitionKey": "policy-approval",
    "priority": 50,
    "due": null,
    "parentTaskId": null,
    "followUp": null,
    "tenantId": null,
    "removalTime": "2025-05-11T21:39:22.032+0200",
    "rootProcessInstanceId": "c3adcab0-a135-11ef-b98f-36542ecc2075",
    "taskState": "Deleted"
  },
  // more historical data
]