Camunda 7 has GET /process-instance/{id}/activity-instances
as per the documentation. The API can be used to fetch if a particular process has an incident. I do curious when will the parent incidentIds
populated given I had this case where childActivityInstances
has its incidentIds
field populated but the parent incidentIds
stays empty.
{
"id": "0cf2bb40-91ef-11ef-bc92-3ad8a98f2443",
"parentActivityInstanceId": null,
"activityId": "WF_PUBLISH_STUFFS:53:da73c566-7bb2-11ef-8168-a6f833f14b9d",
"activityType": "processDefinition",
"processInstanceId": "0cf2bb40-91ef-11ef-bc92-3ad8a98f2443",
"processDefinitionId": "WF_PUBLISH_STUFFS:53:da73c566-7bb2-11ef-8168-a6f833f14b9d",
"childActivityInstances": [
{
"id": "ExtTask_GenerateDocument:0e1a98bf-91ef-11ef-bc92-3ad8a98f2443",
"parentActivityInstanceId": "0cf2bb40-91ef-11ef-bc92-3ad8a98f2443",
"activityId": "ExtTask_GenerateDocument",
"activityType": "serviceTask",
"processInstanceId": "0cf2bb40-91ef-11ef-bc92-3ad8a98f2443",
"processDefinitionId": "WF_PUBLISH_STUFFS:53:da73c566-7bb2-11ef-8168-a6f833f14b9d",
"childActivityInstances": [],
"childTransitionInstances": [],
"executionIds": [
"0e1a98be-91ef-11ef-bc92-3ad8a98f2443"
],
"activityName": "Generate Document",
"incidentIds": [
"7cbce466-91ef-11ef-bc92-3ad8a98f2443"
],
"incidents": [
{
"id": "7cbce466-91ef-11ef-bc92-3ad8a98f2443",
"activityId": "ExtTask_GenerateDocument"
}
],
"name": "Generate Document"
}
],
"childTransitionInstances": [],
"executionIds": [
"0cf2bb40-91ef-11ef-bc92-3ad8a98f2443"
],
"activityName": "Publish Stuff",
"incidentIds": [],
"incidents": [],
"name": "Publish Stuff"
}
Should I recursively checks for incidentIds
to get all of incidents the process got? Is there another ways of getting incidents of a particular process as a list instead of having to navigate the json recursively?
Also, related question, if a service task activity had "technical error" (e.g. http request failed due to network issue) and it still has retries available, will it emit an incident?
Note: I'm running Camunda 7.16 to be specific
You can use the Incidents API to directly retrieve all incidents for a specific process instance: GET /incident?processInstanceId=<processInstanceId>