AnsweredAssumed Answered

Process instance variable to drive Service Task

Question asked by rdewall on Mar 17, 2011
Latest reply on Mar 17, 2011 by rdewall
Generally these are questions to help me understand process instance variables and their usage within a service task.

If I understand correctly, the service task instance is essentially a singleton and is shared among all process instances.  When the service class task is instantiated, its field injection is permanent to that instance.

Given that, if I wish to drive a service task conditionally based upon process instance variables, can that be done?  For example, serviceTaskA, when executed by processInstanceA with variable X=1 should perform one way, while serviceTaskA, when executed by processInstanceA with variable X=2 should perform another.

The documentation alludes to this in the statement:

"To inject values that are dynamically resolved at runtime, expressions can be used."

It then goes on to reiterate the singleton nature of the class:

"Since the Java class instance is reused, the injection only happens once, when the serviceTask is called the first time. When the fields are altered by your code, the values won't be re-injected so you should treat them as immutable and don't make any changes to them."

What am I missing, or is my use-case not achievable in this fashion?