Linking Call Activity to its process definition

Hello,

I’m building a viewer that draws process definitions from the BPMN XML.
Everything works, except when I hit a Call Activity.

The BPMN XML for the Call Activity gives me the calledElement (which looks like the processId). But when I try to fetch the called process via the REST API, it expects the processDefinitionKey, not the id.

What I’m trying to do is that when a user clicks a Call Activity, navigate them to the process it calls (by drawing that process definition).

so my problem is that I can’t figure out how to go from the calledElement in the XML → the processDefinitionKey that the REST API requires.

What’s the right way to resolve this mapping?

Thanks in advance

Hello! I can help you solve this mapping problem between calledElement and processDefinitionKey.

The Solution

The key insight is that the calledElement in your BPMN XML contains the BPMN Process ID (also called bpmnProcessId), which you need to map to the process definition key that the REST API expects.

Here’s the two-step approach:

Step 1: Search for Process Definition by BPMN Process ID

Use the Operate API to search for process definitions by the bpmnProcessId:

POST /v1/process-definitions/search

Request body:

{
  "filter": {
    "bpmnProcessId": "your-called-element-value"
  }
}

This will return matching process definitions including the key field, which is the processDefinitionKey you need.

Step 2: Fetch the BPMN XML using the Process Definition Key

Once you have the key from step 1, use it to fetch the BPMN XML:

GET /v1/process-definitions/{key}/xml

Complete Workflow

  1. Parse your BPMN XML and extract the calledElement value from the Call Activity
  2. Call POST /v1/process-definitions/search with bpmnProcessId filter using the calledElement value
  3. Extract the key from the response (this is your processDefinitionKey)
  4. Call GET /v1/process-definitions/{key}/xml to get the called process BPMN XML
  5. Render the new process definition in your viewer

Important Notes

  • The calledElement corresponds to the BPMN Process ID, not the process definition key
  • Multiple versions of the same process can exist, so you might get multiple results. You’ll need to decide which version to display (latest, specific version, etc.)
  • Make sure you’re using the Operate API endpoints for this functionality

References

This should solve your mapping problem! Let me know if you need clarification on any of these steps.

1 Like

Solution Summary

The problem was successfully resolved! Here’s what we determined:

The Issue: You needed to map a Call Activity’s calledElement (from BPMN XML) to a processDefinitionKey (for REST API calls).

The Solution:

  1. The calledElement contains the BPMN Process ID (bpmnProcessId)
  2. Use POST /v1/process-definitions/search with a filter on bpmnProcessId to find the process definition
  3. Extract the key from the response (this is your processDefinitionKey)
  4. Use GET /v1/process-definitions/{key}/xml to fetch the called process BPMN XML

This two-step API approach using Camunda’s Operate API allows you to successfully navigate from Call Activities to their referenced process definitions in your BPMN viewer.

The key insight was understanding that calledElement = bpmnProcessIdprocessDefinitionKey, and using the search API to bridge this gap.

Happy building! :rocket:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.