AnsweredAssumed Answered

How to create a variable JavaServiceTask ?

Question asked by vire7777 on Nov 20, 2012
Latest reply on Nov 22, 2012 by vire7777
Hi people :)

I'm creating a new workflow with our cool activiti stuff and wondering if that's possible to create a javaServiceTask with a variable activiti class to be used in multiple workflow instance with different goals. For example, the first workflow instance would initialize "myVariable" to call MyFirstClass.java in my javaServiceTask, and, at the contrary, the second instance would call "MySecondClass.java" (for example, because the creating users don't have the same rights, so the called classes are not the same or because i want to create a tool to generate workflow templates but where you can specify in a previous task what you want this template do).

In the userGuide, i've seen something so similar for an other task type :

<businessRuleTask id="businessRuleTask" activiti:class="${MyRuleServiceDelegate}" />

And i was trying to do something close for my javaServiceTask :

<serviceTask id="javaService2" name="Java service invocation" activiti:class="${testVariable}"></serviceTask>

But it generates two errors in my bpmn20 validation :

Multiple annotations found at this line:
   - cvc-attribute.3: The value '${testVariable}' of attribute 'activiti:class' on element 'serviceTask' is not valid with respect to its type, 'null'.
   - cvc-pattern-valid: Value '${testVariable}' is not facet-valid with respect to pattern '([a-z]{2,3}(\.[a-zA-Z][a-zA-Z_$0-9]*)*)\.([A-Z][a-zA-Z_$0-9]*)' for type '#AnonType_class'.

Then… does anyone has an idea how to do it ?
Thanks for your time :)

Outcomes