AnsweredAssumed Answered

can i send user task form elements to task listner with any way ?

Question asked by rakesh.world86 on Jul 15, 2015
Latest reply on Jul 18, 2015 by balsarori
in this xml , there is a string ,
<blockcode>
<activiti:field name="fldLicenseApprove">
</blockcode>
i want to send user task form elements to task listner ,
thats why i want to save these values in custom database using Java TaskListener.

i am unable to send usertask form data to task listner . i have tried a lot but got unsuccessfull.

pls help me . i am stuck in this since 2 days.

<blockcode>
<?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:xsd="http://www.w3.org/2001/XMLSchema" 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://activiti.org/bpmn20" id="definitions">
  <process id="ApplyForLicenseCallBackGz9" name="New Xml for Apply for license" isExecutable="true">
    <startEvent id="request" activiti:initiator="employeeName">
      <extensionElements>
        
        <activiti:formProperty id="licenseHolderName" name="licenseHolderName" type="string" required="true"></activiti:formProperty>
      </extensionElements>
    </startEvent>
    <sequenceFlow id="flow1" sourceRef="request" targetRef="handleRequest"></sequenceFlow>
    <userTask id="handleRequest" name="Handle license request" activiti:assignee="kermitGz9">
      <documentation>{"estimateHours":"48 Hrs","documentation":"${licenseHolderName} has applied for license","label":"Apply for license","id":"ApplyForLicense"}.</documentation>
      <extensionElements>
        <activiti:formProperty id="licenseApproved" name="Do you approve this license" type="string" required="true"></activiti:formProperty>
        <activiti:formProperty id="Comments" name="Comments" type="string"></activiti:formProperty>
       
        <activiti:taskListener event="create" expression="${myobject.join(task,task.eventName,'customText')}">
           <activiti:field name="fldLicenseApprove">
              <activiti:string>
               ${licenseApproved}
               </activiti:string>
          </activiti:field>
       </activiti:taskListener>
       <activiti:taskListener event="complete" class="org.ReverseStringsFieldInjected1">
           <activiti:field name="text">
              <activiti:string>
                   ${licenseApproved}
               </activiti:string>
          </activiti:field>
       </activiti:taskListener>
       
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow2" sourceRef="handleRequest" targetRef="requestApprovedDecision"></sequenceFlow>
    <exclusiveGateway id="requestApprovedDecision" name="Request approved?" default="sendApprovalMail"></exclusiveGateway>
    <sequenceFlow id="flow3" sourceRef="requestApprovedDecision" targetRef="sendApprovalMail">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${licenseApproved == 'true'}]]></conditionExpression>
    </sequenceFlow>
   
    <userTask id="sendApprovalMail" name="Java service invocation">
       <documentation>manager has approved license request.</documentation>
   </userTask>
    
   <sequenceFlow id="flow4" sourceRef="sendApprovalMail" targetRef="theEnd1"></sequenceFlow>
    <endEvent id="theEnd1"></endEvent>
    <sequenceFlow id="flow5" sourceRef="requestApprovedDecision" targetRef="adjustLicenseRequestTask">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${licenseApproved == 'false'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="adjustLicenseRequestTask" name="Reject License Approval">
      <documentation>Your manager has disapproved your license request . Reason: ${Comments}</documentation>
    </userTask>
    <endEvent id="theEnd2"></endEvent>
    <sequenceFlow id="flow6" sourceRef="adjustLicenseRequestTask" targetRef="theEnd2"></sequenceFlow>
  </process>
</definitions>
</blockcode>

Outcomes