How to access the form properties of a user task through zeebe client?

I have a custom form key configured for all my user tasks. How do I get the form key when processing that user task in a zeebe worker code?

My zeebe worker is configured to process tasks of type “io.camunda.zeebe:userTask”. How in this java method I get to know the properties configured in the bpmn user task?

Thanks.

Hi @JGeek ,

you can read the form key from the custom header of the job.

However, the headers don’t contain the form itself. If you want to read the whole form then you need also the BPMN process.

Best regards,
Philipp

you can read the form key from the custom header of the job.

What would be the header key to fetch the value?

Also I realize that when designing the bpmn diagram, only send-email and service-tasks have the capability to set headers like shown in the screenshot below. Why is that?

In my use case I need a capability for the workflow designer to pass a static string that can be fetched at runtime. In my understanding input and output variables need to be expressions and not static text. So how do I configure static values in the bpmn diagram (especially for receive-tasks) ?

Thanks.

The custom header key is io.camunda.zeebe:formKey.

This is not true. Custom headers are also available for other task types. But only for the task types that can be implemented as a job worker.

A receive task can’t be implemented as a job worker. It awaits a message. Receive tasks | Camunda Platform 8

Expressions can also be static values, called literals: Expressions | Camunda Platform 8

Since Zeebe 8.0, it is also possible to pass static values directly as input mappings. See here: Simplify injection of static values via `zeebe:input` · Issue #8733 · camunda/zeebe · GitHub

That’s helpful.
Let me reclarify my problem statement -

I need a way to pass a static string that is configured when designing the workflow bpmn diagram to the Zeebe client at runtime.

  1. One solution that I am thinking I could do that through process instance variable where I would need zeeQS to get the runtime state. With your above reply I could set the static string as an input variable (translates to process instance variable) to a script/send/user etc tasks but these all require some server side code to execute - zeebe worker. I don’t want the workflow to block or any zeebe worker to be coded for this. What bpmn element do I define in the diagram to update the process instance variable to a static value?

  2. Are there any simpler ways to the problem I stated?

Thanks.

On the first point I used “Intermediate Event” bpmn element to set an output variable (static string) which can be accessed via zeeqs.

Any simpler approach?

For me, your use case sounds a bit special.

But your idea with the intermediate throw event sounds reasonable.

1 Like