Accessing process metadata in Feel expressions

Hi, I want to set the Type of a Service Task as a concatenation of the [Process ID] and [Task ID] using Feel Expression, is it possible ?

If this is not possible, is there another alternative to do this ?

Hi @ftaniguti - currently they are not available, but we do have this on our roadmap. You can follow this GitHub issue for updates.

Why do you want to concatenate these values for the type of service task? Without knowing what you are trying to do, I don’t think I can offer any workarounds.

I just used a script task to grab metadata like process ID and version, then stored it in variables. After that, it was easy to use them later in a FEEL expression.

Hi @PitSterw , You can use Job Workers to Add Metadata as Variables.

In your job worker, you can add process metadata into the variable map.

Example using Zeebe Node.js or Java client:

job.complete({
  variables: {
    processInstanceKey: job.processInstanceKey,
    elementInstanceKey: job.elementInstanceKey,
    bpmnProcessId: job.bpmnProcessId,
    businessKey: job.businessKey
  }
});

Then you can use these in a FEEL expression like:

starts with(businessKey, "key-")

Use Output Mappings on Service Tasks

If you’re using external workers and want to extract metadata:

  1. Configure an output mapping in the Modeler.
  2. Example expression (in Camunda 8 Modeler under output mapping):
{
  "processInstanceKey": = processInstanceKey,
  "bpmnProcessId": = bpmnProcessId
}

If these are not available yet in context, inject them in the job worker.