AnsweredAssumed Answered

Java Service Task implementation

Question asked by prabhjot on Dec 7, 2011
Latest reply on Dec 8, 2011 by aziesi
Trying to implement a workflow in which it will have a Java service task in which i am fetching data from mysql DB and then i have user task which will have form where i need to populate all fields with data coming from Service task . Please tell me how to forward data from Service task to user task.

Pasting my BPMN file for reference :-

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="LoanActiviti" name="LoanActiviti">
    <documentation>Place documentation for the 'LoanActiviti' process here.</documentation>
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="Service Task" activiti:class="org.activiti.examples.bpmn.servicetask.SysoutDelegate">
      <extensionElements>
        <activiti:field name="customerNameVar">
          <activiti:expression>${customerNameVar}</activiti:expression>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <userTask id="usertask1" name="User Task" activiti:assignee="management">
      <extensionElements>
        <activiti:formProperty id="customerName" name="Customer name" type="string" variable="${customerNameVar}"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="servicetask1" targetRef="usertask1"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow>
  </process>
</definitions>


Also when i put field value in service task it gives below error :-

com.vaadin.event.ListenerMethod$MethodException
Cause: org.activiti.engine.ActivitiException: Field definition uses unexisting field 'customerNameVar' on class org.activiti.examples.bpmn.servicetask.SysoutDelegate
   at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
   at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
   at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1193)
   at com.vaadin.ui.Button.fireClick(Button.java:539)

Please tell me if i am doing it in correct way.

Outcomes