cancel
Showing results for 
Search instead for 
Did you mean: 

Need help eliminating superfluous 'Task Done' task

devodl
Champ in-the-making
Champ in-the-making
Given a simple Activiti workflow (e.g. Review-Approve) once the workflow has completed (i.e. been Approved or Rejected) I expect the workflow to end and any Listeners I defined for the "end" event to complete. Unfortunately this does not occur until the initiator of the workflow performs the mysterious "Task Done" task which I did not define in my workflow, is not required and adds no value. Many of our workflows are initiated automatically and the Initiators do not want to acknowledge each and every completed workflow "Task Done".

Help! How do I eliminate/skip/avoid the Task Done task?

Where is the Task Done task defined? It seems like it is independent of the BPM engine (jBPM or Activiti) and part of the Alfresco workflow framework that calls the actual workflow engine.

This old posting: https://forums.alfresco.com/en/viewtopic.php?f=34&t=24770 does not provide sufficient information for implementation and I suspect it refers to jBPM and not Activiti.

The solution to eliminate Task Done eludes me and any help would be greatly appreciated.

Steve
9 REPLIES 9

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
Hi,

Can you post your process definition file?

Adei

devodl
Champ in-the-making
Champ in-the-making
It's nothing special.  I have been developing/testing using the out of box Review and Approve workflow: review.bpmn20.xml
<?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://alfresco.org">

    <process id="activitiReview" name="Review And Approve Activiti Process">

        <startEvent id="start"
            activiti:formKey="wf:submitReviewTask" />

        <sequenceFlow id='flow1'
            sourceRef='start'
            targetRef='reviewTask' />

        <userTask id="reviewTask" name="Review Task"
            activiti:formKey="wf:activitiReviewTask">
           <extensionElements>
               <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>
                        if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
               <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>
                          execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
           </extensionElements>
            <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${bpm_assignee.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
        </userTask>

        <sequenceFlow id='flow2'
        sourceRef='reviewTask'
            targetRef='reviewDecision' />

        <exclusiveGateway  id="reviewDecision" name="Review Decision" />

        <sequenceFlow id='flow3' sourceRef='reviewDecision' targetRef='approved' >
            <conditionExpression xsi:type="tFormalExpression">${wf_reviewOutcome == 'Approve'}</conditionExpression>
        </sequenceFlow>

        <sequenceFlow id='flow4'
        sourceRef='reviewDecision'
            targetRef='rejected' />

       <userTask id="approved" name="Document Approved"
            activiti:formKey="wf:approvedTask" >
            <documentation>
                The document was reviewed and approved.
            </documentation>
            <extensionElements>
               <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>
                        if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
            </extensionElements>
            <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${initiator.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
        </userTask>
       
        <userTask id="rejected" name="Document Rejected"
            activiti:formKey="wf:rejectedTask" >
            <documentation>
                The document was reviewed and rejected.
            </documentation>
            <extensionElements>
               <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>
                        if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
            </extensionElements>
            <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${initiator.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
        </userTask>

        <sequenceFlow id='flow5' sourceRef='approved'
            targetRef='end' />

        <sequenceFlow id='flow6' sourceRef='rejected'
            targetRef='end' />

        <endEvent id="end" />

    </process>
   
   <!– Graphical representaion of diagram –>
   <bpmndi:BPMNDiagram id="BPMNDiagram_activitiReview">
      <bpmndi:BPMNPlane bpmnElement="activitiReview"
         id="BPMNPlane_activitiReview">
         <bpmndi:BPMNShape bpmnElement="start"
            id="BPMNShape_start">
            <omgdc:Bounds height="35" width="35" x="30" y="200"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="reviewTask"
            id="BPMNShape_reviewTask">
            <omgdc:Bounds height="55" width="105" x="125"
               y="190"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="reviewDecision"
            id="BPMNShape_reviewDecision">
            <omgdc:Bounds height="40" width="40" x="290" y="197"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="approved"
            id="BPMNShape_approved">
            <omgdc:Bounds height="55" width="105" x="390"
               y="97"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="rejected"
            id="BPMNShape_rejected">
            <omgdc:Bounds height="55" width="105" x="390"
               y="297"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
            <omgdc:Bounds height="35" width="35" x="555" y="307"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
            <omgdi:waypoint x="65" y="217"></omgdi:waypoint>
            <omgdi:waypoint x="125" y="217"></omgdi:waypoint>
         </bpmndi:BPMNEdge>
         <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
            <omgdi:waypoint x="230" y="217"></omgdi:waypoint>
            <omgdi:waypoint x="290" y="217"></omgdi:waypoint>
         </bpmndi:BPMNEdge>
         <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
            <omgdi:waypoint x="310" y="197"></omgdi:waypoint>
            <omgdi:waypoint x="310" y="124"></omgdi:waypoint>
            <omgdi:waypoint x="390" y="124"></omgdi:waypoint>
         </bpmndi:BPMNEdge>
         <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
            <omgdi:waypoint x="310" y="237"></omgdi:waypoint>
            <omgdi:waypoint x="310" y="324"></omgdi:waypoint>
            <omgdi:waypoint x="390" y="324"></omgdi:waypoint>
         </bpmndi:BPMNEdge>
         <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
            <omgdi:waypoint x="495" y="124"></omgdi:waypoint>
            <omgdi:waypoint x="572" y="124"></omgdi:waypoint>
            <omgdi:waypoint x="572" y="307"></omgdi:waypoint>
         </bpmndi:BPMNEdge>
         <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
            <omgdi:waypoint x="495" y="324"></omgdi:waypoint>
            <omgdi:waypoint x="555" y="324"></omgdi:waypoint>
         </bpmndi:BPMNEdge>
      </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>

</definitions>

Wait! Can I just remove the <humanPerformer> portion from the Approve and Reject tasks?
<humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${initiator.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
How would I remove the <humanPerformer> using the eclipse plugin where it wants the Assignee set to some Performer Type?

Or do I change the Type of the Approve and Reject tasks from "User Task" to "Script Task" (or some other kind of task)?
If so does the "Script Task" need to do anything special to "complete" the task?

mitpatoliya
Star Collaborator
Star Collaborator
Hi steve,
You can remove the wf:approvedTask  task.
then one more you need to change is in review task transition approve should lead directly to the end state rather then approved state.

devodl
Champ in-the-making
Champ in-the-making
Basing my learning on the out of box review.bpmn20.xml workflow I took the suggestion from @mitpatoliya to remove the User Tasks (Approved, Rejected) and route the decision directly to the End task. Here is the resulting definition:
<?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://alfresco.org">
  <process id="reviewTest" name="Review And Approve Test">
    <startEvent id="start" name="Start" activiti:formKey="wf:submitReviewTask"></startEvent>
    <userTask id="reviewTask" name="Review Task" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <exclusiveGateway id="reviewDecision" name="Review Decision"></exclusiveGateway>
    <endEvent id="end" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="start" targetRef="reviewTask"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="reviewTask" targetRef="reviewDecision"></sequenceFlow>
    <sequenceFlow id="flow7" name="Approve" sourceRef="reviewDecision" targetRef="end">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Approve'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow8" name="Reject" sourceRef="reviewDecision" targetRef="end">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_reviewTest">
    <bpmndi:BPMNPlane bpmnElement="reviewTest" id="BPMNPlane_reviewTest">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="35" width="35" x="30" y="200"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="reviewTask" id="BPMNShape_reviewTask">
        <omgdc:Bounds height="55" width="105" x="105" y="190"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="reviewDecision" id="BPMNShape_reviewDecision">
        <omgdc:Bounds height="40" width="40" x="250" y="197"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="35" width="35" x="475" y="207"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="65" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="105" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="210" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="250" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="270" y="197"></omgdi:waypoint>
        <omgdi:waypoint x="270" y="176"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="176"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="207"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="270" y="237"></omgdi:waypoint>
        <omgdi:waypoint x="270" y="275"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="275"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="242"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
In doing so I moved the simple Listeners (alfrescoScriptType) from the User Tasks to the <sequenceFlow>
if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
Unfortunately now when the User approves the workflow it throws an error:
org.alfresco.scripts.ScriptException: 02302769 Failed to execute supplied script: 02302768 ReferenceError: "task" is not defined. (AlfrescoJS#1)
which implies that the JavaScript in the flow cannot reference the "task" object.

Summary
Original User Task for Approved between Decision and End
<userTask id="approved" name="Document Approved"
            activiti:formKey="wf:approvedTask" >
            <documentation>
                The document was reviewed and approved.
            </documentation>
            <extensionElements>
               <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
                  <activiti:field name="script">
                     <activiti:string>
                        if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
                     </activiti:string>
                  </activiti:field>
               </activiti:taskListener>
            </extensionElements>
            <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${initiator.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
        </userTask>

New "Approve" Flow between Decision to End
<sequenceFlow id="flow7" name="Approve" sourceRef="reviewDecision" targetRef="end">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Approve'}]]></conditionExpression>
    </sequenceFlow>

So I'm puzzled why the original wf:approvedTask Listener could reference the "task" object but now the new <sequencedFlow> throws the error.

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
What you'd need to do is pass from the original UserTask to a Service task as follows:


<serviceTask id="approved" name="Document Approved"
         activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
         <documentation>
            The document was reviewed and approved.
         </documentation>
         <extensionElements>
            <activiti:field name="runAs">
                  <activiti:string>System</activiti:string>
               </activiti:field>
            <activiti:field name="script">
               <activiti:string>
                  if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
               </activiti:string>
            </activiti:field>
         </extensionElements>
      </serviceTask>

As you'll see the task does nothing but set the dueDate and priority. you could also directly get rid of the Approved and Rejected tasks and change the sequence flow 3 and 4's targetRef to end

Adei

devodl
Champ in-the-making
Champ in-the-making
Adei,
I'm getting more confused, my BPMN2.0 XML doesn't look anything like what you posted. I am using the Activiti eclipse plugin to model the workflow and when I create Service Tasks (to replace the User Tasks) the XML in the .activiti file looks like this:

<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms">
  <pi:Diagram visible="true" gridUnit="10" diagramTypeId="BPMNdiagram" name="reviewTest" snapToGrid="true" showGuides="true" pictogramLinks="/0/@children.0/@link /0/@children.1/@link /0/@children.1/@children.0/@link /0/@children.2/@link /0/@children.3/@link /0/@connections.0/@link /0/@connections.1/@link /0/@connections.2/@link /0/@connections.3/@link /0/@children.4/@link /0/@children.4/@children.0/@link /0/@connections.4/@link /0/@children.5/@link /0/@children.5/@children.0/@link /0/@connections.5/@link">
    <graphicsAlgorithm xsi:type="al:Rectangle" background="/0/@colors.1" foreground="/0/@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Ellipse" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="35" height="35" x="30" y="200">
        <graphicsAlgorithmChildren xsi:type="al:Ellipse" lineWidth="1" transparency="0.0" width="35" height="35" style="/0/@styles.0"/>
      </graphicsAlgorithm>
      <link businessObjects="start"/>
      <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="/0/@connections.0"/>
      <anchors xsi:type="pi:BoxRelativeAnchor" visible="true" active="true" referencedGraphicsAlgorithm="/0/@children.0/@graphicsAlgorithm/@graphicsAlgorithmChildren.0" relativeWidth="1.0" relativeHeight="0.51">
        <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false"/>
      </anchors>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Image" lineWidth="1" transparency="0.0" width="16" height="16" x="10" y="10" id="org.activiti.designer.alfresco.logo" stretchH="false" stretchV="false" proportional="false"/>
      </children>
    </children>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="105" height="55" x="105" y="190">
        <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" lineWidth="1" transparency="0.0" width="105" height="55" style="/0/@styles.1" cornerHeight="20" cornerWidth="20"/>
      </graphicsAlgorithm>
      <link businessObjects="reviewTask"/>
      <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="/0/@connections.1" incomingConnections="/0/@connections.0"/>
      <anchors xsi:type="pi:BoxRelativeAnchor" visible="true" active="true" referencedGraphicsAlgorithm="/0/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.0" relativeWidth="1.0" relativeHeight="0.51">
        <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false"/>
      </anchors>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:MultiText" lineWidth="1" transparency="0.0" width="105" height="30" y="20" style="/0/@styles.1" font="/0/@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="Review Task"/>
        <link businessObjects="reviewTask"/>
      </children>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Image" lineWidth="1" transparency="0.0" width="16" height="16" x="5" y="5" id="org.activiti.designer.usertask" stretchH="false" stretchV="false" proportional="false"/>
      </children>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Image" lineWidth="1" transparency="0.0" width="16" height="16" x="85" y="3" id="org.activiti.designer.alfresco.logo" stretchH="false" stretchV="false" proportional="false"/>
      </children>
    </children>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Polygon" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="40" height="40" x="250" y="197">
        <graphicsAlgorithmChildren xsi:type="al:Polygon" lineWidth="1" transparency="0.0" width="40" height="40" style="/0/@styles.0">
          <points y="20"/>
          <points x="20"/>
          <points x="40" y="20"/>
          <points x="20" y="40"/>
          <points y="20"/>
        </graphicsAlgorithmChildren>
        <points y="20"/>
        <points x="20"/>
        <points x="40" y="20"/>
        <points x="20" y="40"/>
        <points y="20"/>
      </graphicsAlgorithm>
      <link businessObjects="reviewDecision"/>
      <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="/0/@connections.2 /0/@connections.3" incomingConnections="/0/@connections.1"/>
      <anchors xsi:type="pi:BoxRelativeAnchor" visible="true" active="true" referencedGraphicsAlgorithm="/0/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0" relativeWidth="0.51" relativeHeight="0.1">
        <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false"/>
      </anchors>
      <anchors xsi:type="pi:ChopboxAnchor"/>
      <anchors xsi:type="pi:BoxRelativeAnchor" visible="true" active="true" referencedGraphicsAlgorithm="/0/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0" relativeWidth="0.51" relativeHeight="0.93">
        <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false"/>
      </anchors>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Polyline" lineWidth="5" filled="false" transparency="0.0" style="/0/@styles.0">
          <points x="30" y="10"/>
          <points x="10" y="30"/>
        </graphicsAlgorithm>
      </children>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Polyline" lineWidth="5" filled="false" transparency="0.0" style="/0/@styles.0">
          <points x="10" y="10"/>
          <points x="30" y="30"/>
        </graphicsAlgorithm>
      </children>
    </children>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Ellipse" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="35" height="35" x="475" y="207">
        <graphicsAlgorithmChildren xsi:type="al:Ellipse" lineWidth="3" transparency="0.0" width="35" height="35" style="/0/@styles.0"/>
      </graphicsAlgorithm>
      <link businessObjects="end"/>
      <anchors xsi:type="pi:ChopboxAnchor" incomingConnections="/0/@connections.4 /0/@connections.5"/>
    </children>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="105" height="55" x="330" y="146">
        <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" lineWidth="1" transparency="0.0" width="105" height="55" style="/0/@styles.1" cornerHeight="20" cornerWidth="20"/>
      </graphicsAlgorithm>
      <link businessObjects="servicetask1"/>
      <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="/0/@connections.4" incomingConnections="/0/@connections.2"/>
      <anchors xsi:type="pi:BoxRelativeAnchor" visible="true" active="true" referencedGraphicsAlgorithm="/0/@children.4/@graphicsAlgorithm/@graphicsAlgorithmChildren.0" relativeWidth="1.0" relativeHeight="0.51">
        <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false"/>
      </anchors>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:MultiText" lineWidth="1" transparency="0.0" width="105" height="30" y="20" style="/0/@styles.1" font="/0/@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="Approve Service Task"/>
        <link businessObjects="servicetask1"/>
      </children>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Image" lineWidth="1" transparency="0.0" width="16" height="16" x="5" y="5" id="org.activiti.designer.servicetask" stretchH="false" stretchV="false" proportional="false"/>
      </children>
    </children>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="105" height="55" x="330" y="244">
        <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" lineWidth="1" transparency="0.0" width="105" height="55" style="/0/@styles.1" cornerHeight="20" cornerWidth="20"/>
      </graphicsAlgorithm>
      <link businessObjects="servicetask2"/>
      <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="/0/@connections.5" incomingConnections="/0/@connections.3"/>
      <anchors xsi:type="pi:BoxRelativeAnchor" visible="true" active="true" referencedGraphicsAlgorithm="/0/@children.5/@graphicsAlgorithm/@graphicsAlgorithmChildren.0" relativeWidth="1.0" relativeHeight="0.51">
        <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false"/>
      </anchors>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:MultiText" lineWidth="1" transparency="0.0" width="105" height="30" y="20" style="/0/@styles.1" font="/0/@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="Reject Service Task"/>
        <link businessObjects="servicetask2"/>
      </children>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Image" lineWidth="1" transparency="0.0" width="16" height="16" x="5" y="5" id="org.activiti.designer.servicetask" stretchH="false" stretchV="false" proportional="false"/>
      </children>
    </children>
    <styles foreground="/0/@colors.2" lineWidth="20" id="EVENT">
      <renderingStyle>
        <adaptedGradientColoredAreas definedStyleId="bpmnEventStyle" gradientType="0">
          <adaptedGradientColoredAreas styleAdaption="0">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="250" green="251" blue="252"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="250" green="251" blue="252"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
          <adaptedGradientColoredAreas styleAdaption="0">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="229" green="229" blue="194"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="229" green="229" blue="194"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
          <adaptedGradientColoredAreas styleAdaption="0">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="229" green="229" blue="194"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="229" green="229" blue="194"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
        </adaptedGradientColoredAreas>
      </renderingStyle>
    </styles>
    <styles foreground="/0/@colors.2" lineWidth="20" id="TASK">
      <renderingStyle>
        <adaptedGradientColoredAreas definedStyleId="bpmnTaskStyle" gradientType="0">
          <adaptedGradientColoredAreas styleAdaption="0">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="250" green="251" blue="252"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="255" green="255" blue="204"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
          <adaptedGradientColoredAreas styleAdaption="0">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="229" green="229" blue="194"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="229" green="229" blue="194"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
          <adaptedGradientColoredAreas styleAdaption="0">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="229" green="229" blue="194"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="229" green="229" blue="194"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
        </adaptedGradientColoredAreas>
      </renderingStyle>
    </styles>
    <styles background="/0/@colors.2" foreground="/0/@colors.2" lineWidth="1" id="BPMN-POLYGON-ARROW"/>
    <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="/0/@children.0/@anchors.0" end="/0/@children.1/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
      <link businessObjects="flow1"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" lineWidth="1" transparency="0.0" x="10" style="/0/@styles.1" font="/0/@fonts.0"/>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polygon" lineWidth="1" transparency="0.0" style="/0/@styles.2">
          <points x="-10" y="-5" before="3" after="3"/>
          <points/>
          <points x="-10" y="5" before="3" after="3"/>
          <points x="-8" before="3" after="3"/>
        </graphicsAlgorithm>
      </connectionDecorators>
    </connections>
    <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="/0/@children.1/@anchors.0" end="/0/@children.2/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
      <link businessObjects="flow2"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" lineWidth="1" transparency="0.0" x="10" style="/0/@styles.1" font="/0/@fonts.0"/>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polygon" lineWidth="1" transparency="0.0" style="/0/@styles.2">
          <points x="-10" y="-5" before="3" after="3"/>
          <points/>
          <points x="-10" y="5" before="3" after="3"/>
          <points x="-8" before="3" after="3"/>
        </graphicsAlgorithm>
      </connectionDecorators>
    </connections>
    <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="/0/@children.2/@anchors.0" end="/0/@children.4/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
      <link businessObjects="flow7"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" lineWidth="1" transparency="0.0" x="10" style="/0/@styles.1" font="/0/@fonts.0" value=""/>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polygon" lineWidth="1" transparency="0.0" style="/0/@styles.2">
          <points x="-10" y="-5" before="3" after="3"/>
          <points/>
          <points x="-10" y="5" before="3" after="3"/>
          <points x="-8" before="3" after="3"/>
        </graphicsAlgorithm>
      </connectionDecorators>
      <bendpoints x="270" y="176"/>
    </connections>
    <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="/0/@children.2/@anchors.0" end="/0/@children.5/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
      <link businessObjects="flow8"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" lineWidth="1" transparency="0.0" x="10" style="/0/@styles.1" font="/0/@fonts.0" value=""/>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polygon" lineWidth="1" transparency="0.0" style="/0/@styles.2">
          <points x="-10" y="-5" before="3" after="3"/>
          <points/>
          <points x="-10" y="5" before="3" after="3"/>
          <points x="-8" before="3" after="3"/>
        </graphicsAlgorithm>
      </connectionDecorators>
      <bendpoints x="270" y="275"/>
    </connections>
    <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="/0/@children.4/@anchors.0" end="/0/@children.3/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
      <link businessObjects="flow9"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" lineWidth="1" transparency="0.0" x="10" style="/0/@styles.1" font="/0/@fonts.0" value=""/>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polygon" lineWidth="1" transparency="0.0" style="/0/@styles.2">
          <points x="-10" y="-5" before="3" after="3"/>
          <points/>
          <points x="-10" y="5" before="3" after="3"/>
          <points x="-8" before="3" after="3"/>
        </graphicsAlgorithm>
      </connectionDecorators>
      <bendpoints x="492" y="173"/>
    </connections>
    <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="/0/@children.5/@anchors.0" end="/0/@children.3/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
      <link businessObjects="flow10"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" lineWidth="1" transparency="0.0" x="10" style="/0/@styles.1" font="/0/@fonts.0" value=""/>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polygon" lineWidth="1" transparency="0.0" style="/0/@styles.2">
          <points x="-10" y="-5" before="3" after="3"/>
          <points/>
          <points x="-10" y="5" before="3" after="3"/>
          <points x="-8" before="3" after="3"/>
        </graphicsAlgorithm>
      </connectionDecorators>
      <bendpoints x="492" y="271"/>
    </connections>
    <colors red="227" green="238" blue="249"/>
    <colors red="255" green="255" blue="255"/>
    <colors/>
    <fonts name="Arial" size="8"/>
  </pi:Diagram>
  <bpmn2:Process id="reviewTest" name="Review And Approve Test" namespace="http://alfresco.org">
    <documentation id="documentation_process" text=""/>
  </bpmn2:Process>
  <bpmn2:AlfrescoStartEvent id="start" name="Start" outgoing="flow1" formKey="wf:submitReviewTask"/>
  <bpmn2:AlfrescoUserTask id="reviewTask" name="Review Task" incoming="flow1" outgoing="flow2" assignee="${bpm_assignee.properties.userName}" formKey="wf:activitiReviewTask">
    <activitiListeners implementationType="alfrescoScriptType" implementation="if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate&#xA;if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;" event="create"/>
    <activitiListeners implementationType="alfrescoScriptType" implementation="execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));" event="complete"/>
  </bpmn2:AlfrescoUserTask>
  <bpmn2:ExclusiveGateway id="reviewDecision" name="Review Decision" incoming="flow2" outgoing="flow7 flow8"/>
  <bpmn2:EndEvent id="end" name="End" incoming="flow9 flow10"/>
  <bpmn2:SequenceFlow id="flow1" sourceRef="start" targetRef="reviewTask"/>
  <bpmn2:SequenceFlow id="flow2" sourceRef="reviewTask" targetRef="reviewDecision"/>
  <bpmn2:SequenceFlow id="flow7" name="" sourceRef="reviewDecision" targetRef="servicetask1">
    <conditionExpression id="flow7_condition" body="${wf_reviewOutcome == 'Approve'}"/>
  </bpmn2:SequenceFlow>
  <bpmn2:SequenceFlow id="flow8" name="" sourceRef="reviewDecision" targetRef="servicetask2"/>
  <bpmn2:ServiceTask id="servicetask1" name="Approve Service Task" incoming="flow7" outgoing="flow9">
    <activitiListeners implementationType="alfrescoScriptType" implementation="if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate&#xD;&#xA;if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;" event="start" runAs="" scriptProcessor=""/>
  </bpmn2:ServiceTask>
  <bpmn2:SequenceFlow id="flow9" name="" sourceRef="servicetask1" targetRef="end"/>
  <bpmn2:ServiceTask id="servicetask2" name="Reject Service Task" incoming="flow8" outgoing="flow10">
    <activitiListeners implementationType="alfrescoScriptType" implementation="if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate&#xD;&#xA;if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;" event="start" runAs="" scriptProcessor=""/>
  </bpmn2:ServiceTask>
  <bpmn2:SequenceFlow id="flow10" name="" sourceRef="servicetask2" targetRef="end"/>
</xmi:XMI>
And then the generated reviewTest.bpmn20.xml file looks like this:
<?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://alfresco.org">
  <process id="reviewTest" name="Review And Approve Test">
    <startEvent id="start" name="Start" activiti:formKey="wf:submitReviewTask"></startEvent>
    <userTask id="reviewTask" name="Review Task" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <exclusiveGateway id="reviewDecision" name="Review Decision"></exclusiveGateway>
    <endEvent id="end" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="start" targetRef="reviewTask"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="reviewTask" targetRef="reviewDecision"></sequenceFlow>
    <sequenceFlow id="flow7" name="Approve" sourceRef="reviewDecision" targetRef="end">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Approve'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow8" name="Reject" sourceRef="reviewDecision" targetRef="end">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_reviewTest">
    <bpmndi:BPMNPlane bpmnElement="reviewTest" id="BPMNPlane_reviewTest">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="35" width="35" x="30" y="200"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="reviewTask" id="BPMNShape_reviewTask">
        <omgdc:Bounds height="55" width="105" x="105" y="190"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="reviewDecision" id="BPMNShape_reviewDecision">
        <omgdc:Bounds height="40" width="40" x="250" y="197"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="35" width="35" x="475" y="207"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="65" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="105" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="210" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="250" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="270" y="197"></omgdi:waypoint>
        <omgdi:waypoint x="270" y="176"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="176"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="207"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="270" y="237"></omgdi:waypoint>
        <omgdi:waypoint x="270" y="275"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="275"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="242"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
Nowhere do I see any XML with the <serviceTask> element.
Are you using Activiti 5.9 and BPMN2.0?

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
Hi,

I'm not using the eclipse plugin to be honest just followed Alfresco's and Activiti's wiki sites to create it.

Checking your XML file doesn't seem you are creating service tasks but just removing them as you go directly from the review state to the end one and you are just adding listeners to each sequence flow (which is also fine).

In your previous post you said:
Basing my learning on the out of box review.bpmn20.xml workflow I took the suggestion from @mitpatoliya to remove the User Tasks (Approved, Rejected) and route the decision directly to the End task. Here is the resulting definition:

The xml looks the same as in that post.

Adei

devodl
Champ in-the-making
Champ in-the-making
Adei,
Thank you for your perserverance and sticking with me.
Starting with the out-of-box Review-Approve activiti process I have modified the process to create a workflow to skip the "Task Done" task three ways:
1 - Decision gateway goes directly to End (Mits sugggestion)
2 - Decision gateway goes to Script task (My idea)
3 - Decision gateway goes to Service task (Adei's suggestion)
Here is the workflow that uses a Service Task:
<?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://alfresco.org">
  <process id="reviewService" name="Review-Approve Service">
    <startEvent id="start" name="Start" activiti:formKey="wf:submitReviewTask"></startEvent>
    <userTask id="reviewTask" name="Review Task" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <exclusiveGateway id="reviewDecision" name="Review Decision"></exclusiveGateway>
    <endEvent id="end" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="start" targetRef="reviewTask"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="reviewTask" targetRef="reviewDecision"></sequenceFlow>
    <sequenceFlow id="flow7" name="" sourceRef="reviewDecision" targetRef="servicetask1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Approve'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow8" name="" sourceRef="reviewDecision" targetRef="servicetask2"></sequenceFlow>
    <serviceTask id="servicetask1" name="Approve Service Task" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
      <extensionElements>
            <activiti:field name="runAs">
                  <activiti:string>System</activiti:string>
               </activiti:field>
            <activiti:field name="script">
               <activiti:string>
                  if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
               </activiti:string>
            </activiti:field>
         </extensionElements>
    </serviceTask>
    <sequenceFlow id="flow9" name="" sourceRef="servicetask1" targetRef="end"></sequenceFlow>
    <serviceTask id="servicetask2" name="Reject Service Task" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
<extensionElements>
            <activiti:field name="runAs">
                  <activiti:string>System</activiti:string>
               </activiti:field>
            <activiti:field name="script">
               <activiti:string>
                  if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
               </activiti:string>
            </activiti:field>
         </extensionElements>
             </serviceTask>
    <sequenceFlow id="flow10" name="" sourceRef="servicetask2" targetRef="end"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_reviewService">
    <bpmndi:BPMNPlane bpmnElement="reviewService" id="BPMNPlane_reviewService">
      <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
        <omgdc:Bounds height="35" width="35" x="30" y="200"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="reviewTask" id="BPMNShape_reviewTask">
        <omgdc:Bounds height="55" width="105" x="105" y="190"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="reviewDecision" id="BPMNShape_reviewDecision">
        <omgdc:Bounds height="40" width="40" x="250" y="197"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
        <omgdc:Bounds height="35" width="35" x="475" y="207"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
        <omgdc:Bounds height="55" width="105" x="330" y="146"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="servicetask2" id="BPMNShape_servicetask2">
        <omgdc:Bounds height="55" width="105" x="330" y="244"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="65" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="105" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="210" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="250" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="270" y="197"></omgdi:waypoint>
        <omgdi:waypoint x="270" y="176"></omgdi:waypoint>
        <omgdi:waypoint x="330" y="173"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="270" y="237"></omgdi:waypoint>
        <omgdi:waypoint x="270" y="275"></omgdi:waypoint>
        <omgdi:waypoint x="330" y="271"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="435" y="173"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="173"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="207"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="435" y="271"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="271"></omgdi:waypoint>
        <omgdi:waypoint x="492" y="242"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
Regardless of which way (1,2, or 3) that I used to define the workflow when I attempt to Approve the Task I get the error:
"Failed to execute supplied script: 030211851 ReferenceError: "task" is not defined. (AlfrescoJS#2)"
which probably occurs when the Task tries to execute the Listener code:
if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
It would appear that the "task" object referenced by the script is instantiated by the out-of-box workflow taskListener:
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:taskListener>
but not for the <serviceTask> or <scriptTask> tasks because those Task types do not declare or use the ScriptTaskListener.

It is clear I need to learn more about Activiti and how objects are passed to the different Task Listeners.  I cannot simply change a task from <userTask> to <scriptTask> to <serviceTask> and expect the "task" object to still be available for reference.

Thanks again for your help.

craig_michael_n
Champ on-the-rise
Champ on-the-rise
I'm sure this has already been solved but my solution was to just put all the business logic into the first task itself depending on if it was approved or not. Here is my sample code
<blockcode>
<userTask id="decision" name="Decision" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));
if(${wf_reviewOutcome}=='Approve') {
for (i = 0; i &lt; bpm_package.children.length; i++) {
            var document = bpm_package.children;
            document.addAspect("wfa:reviewed");
            document.properties["wfa:reviewStatus"] = "approved";
            document.save();
}}else{
for (i = 0; i &lt; bpm_package.children.length; i++) {
            var document = bpm_package.children;
            document.addAspect("wfa:reviewed");
            document.properties["wfa:reviewStatus"] = "rejected";
            document.save();
}}</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.