Camunda DelegateTask getVariable doesn't work

Hi.
This would be my first post here.
I have a camunda process, with two tasks, and the whole process has variables attached to it.
I have a class which implements TaskListener, and I’m trying to retrieve a certain variable, like this:

delegateTask.getVariable(var_name)

However, it returns null.
Can somebody explain how can I retrieve the variable?
Thanks.

Hi Eduard,

This API returns null if the variable value is actually null or if the variable does not exist.

  1. Are you sure the variable is set when your listener is executed?
  2. Are you sure you use the correct variable name?

Cheers,
Thorben

1 Like

I attached the diagram associated with our process.
Actually, we set the variables on the Start node, and we’re trying to retrieve it with a TaskListener which is set on “Execute” task(via notify method)

delegateTask.getVariable(var_name).

Unfortunately, it returns null.
Thanks.