AnsweredAssumed Answered

How to access fields in java service task

Question asked by sk8192 on Nov 12, 2012
Latest reply on Nov 16, 2012 by frederikheremans1
If I have the following task definition:


    <serviceTask id="myServiceTask" name="My Service" activiti:expression="#{myService.myMethod(execution)}" activiti:resultVariableName="result">
      <extensionElements>
        <activiti:field name="testField">
          <activiti:string>testing123</activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>

which corresponds to this java class:


@Component("myServiceTask")
public class MyServiceTask {
  public String myMethod(DelegateExecution execution) {
    // do something with testField
    return "";
  }
}

How can I obtain the value of testField (i.e. "testing123") within the Java class?

Outcomes