Add metadata to incident

Hello,

I would like to add some meta data to incidents (It was possible to add an annotation with Camunda 7).

So that we can easily link incidents to our business objects through an external application.

I didn’t find an equivalent with Camunda 8.
Thx

Hello!

You’re correct that Camunda 8 doesn’t have a direct equivalent to the annotation feature that was available in Camunda 7 for incidents. Camunda 8 does not natively support adding custom metadata, annotations, or external references directly to incident objects.

Recommended Workaround: Process Variables

The recommended approach in Camunda 8 is to use process variables to store custom metadata or external references that you want to associate with incidents. Here’s how this works:

When a job worker fails a job and raises an incident, you can include additional details as variables. These variables are then available for analysis when the incident is reviewed in Operate or accessed via the API.

For example, when failing a job, you can include business object references:

// When failing a job, include custom metadata as variables
client.newFailCommand(job.getKey())
    .retries(job.getRetries() - 1)
    .errorMessage("Processing failed")
    .variables(Map.of(
        "businessObjectId", "12345",
        "externalSystemRef", "https://yoursystem.com/object/12345",
        "errorContext", "Additional context about the failure"
    ))
    .send();

As mentioned in the Job workers documentation:

“There are several advantages when failing a job with variables… it would be useful to provide some additional details through a variable when the incident is analyzed.”

Accessing the Data

You can then access this metadata through:

  • Operate UI: View and modify variables when resolving incidents
  • REST API: Query process instances and their variables
  • External integrations: Use the variables to link back to your business objects

Alternative Approaches

If you need more sophisticated incident management with rich metadata, you might consider:

  1. Building a custom incident management layer that correlates Camunda incidents with your business data
  2. Using process variables combined with external storage systems
  3. Implementing custom monitoring and alerting that captures the additional context you need

While this approach requires storing the metadata as process data rather than directly on the incident object, it provides the functionality you need to link incidents to your business objects through external applications.

Would you like me to elaborate on any of these approaches or help you design a specific solution for your use case?