Call a Java delegate code with parameter


#1

Hi,

I have two service tasks that both need to call the save delegate java class but with different parameter.
How to achieve this? In the modeler I set the #{myjavadelegateclass} in the implementation but how to pass the parameter?

Thanks!


#2

Hi @kontrag,

Have a look at below docs

https://docs.camunda.org/manual/latest/user-guide/process-engine/delegation-code/#field-injection


#3

Hi @kontrag

You can also use Input mappings as an alternative:

https://docs.camunda.org/manual/7.9/user-guide/process-engine/variables/#input-output-variable-mapping

Best,
Ben


#4

Thanks @benhoffmann, but I have an execution listener in a start event, so I can’t have a variable mapping there. But the field injection that @hassang suggested works fine!
Thanks!