cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Service Task Listener Fields

arandall
Champ in-the-making
Champ in-the-making
I would like to create a generic execution listener to update key/value pairs. The keys are dynamic so I don't want to create an Expression for each one in my ExecutionListener.

After reading the documentation (http://activiti.org/userguide/index.html#serviceTaskFieldInjection) and code I found that the fields key/values specified are injected into the object thus I can't access all the fields from a delegate or execution listener. Is this correct?

One post that I did find from a few years ago was http://forums.activiti.org/content/servicetask-field-types which is essentially what I'm after.

Can someone suggest how this maybe achieved with Activiti?

Thanks.
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
Dynamic injection is not possible indeed, you need to have setters/getters for each of of the values you define. This is not possible for the moment, using plain field-injection. A solution can be to use a JSON-structure (or whatever format you like) as value of the <activiti:string> element, containing the key/value combinations. Use Jackson or whatever JSON parser you want in the delegate listener to get a Map from the JSON-structure, defined in the BPMN.