AnsweredAssumed Answered

User task is automatically rejected

Question asked by pnature on Mar 28, 2017
Latest reply on Aug 22, 2017 by s00pa

Hi.

I am new and I am using Alfresco 5.1 community version.

I have created workflow with user tasks.

 

<?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://www.activiti.org/test">
  <process id="approveCommandContributionProcess" name="Approve Command Contribution Process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="Usertask2a" targetRef="mailtask1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="mailtask1" targetRef="exclusivegateway2"></sequenceFlow>
    <serviceTask id="servicetask1" name="Mail Service Task" activiti:class="sk.iway.eod.task.sendMail"></serviceTask>
    <serviceTask id="mailtask1" name="Mail Task" activiti:type="mail">
      <extensionElements>
        <activiti:field name="to">
          <activiti:expression><![CDATA[${userEmail}]]></activiti:expression>
        </activiti:field>
        <activiti:field name="from">
          <activiti:string><![CDATA[eodMailTask@alfresco.sk]]></activiti:string>
        </activiti:field>
        <activiti:field name="html">
          <activiti:string><![CDATA[Dear customer, you have new document.]]></activiti:string>
        </activiti:field>
        <activiti:field name="subject">
          <activiti:string><![CDATA[Dear customer, you have new document.]]></activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="flow3" sourceRef="startevent1" targetRef="servicetask3"></sequenceFlow>
    <sequenceFlow id="flow4" sourceRef="servicetask2" targetRef="servicetask1">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[execution.setVariable("taskDueDate", execution.getVariable("bpm_workflowDueDate"));]]></activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
    </sequenceFlow>
    <serviceTask id="servicetask2" name="Remove Category Task" activiti:class="sk.iway.eod.task.removeCategory"></serviceTask>
    <userTask id="usertask1" name="Review User Task" activiti:assignee="${initiator.properties.userName}" activiti:dueDate="${taskDueDate}" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow5" sourceRef="servicetask1" targetRef="usertask1">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[logger.log("Alfresco Review document Completed " + execution.getVariable('wf_reviewOutcome'));]]></activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
    </sequenceFlow>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway" default="flowNothing"></exclusiveGateway>
    <sequenceFlow id="flowMail" name="Mail" sourceRef="exclusivegateway1" targetRef="Usertask2a">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${wf_reviewOutcome == 'Rejected'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flowNothing" name="Nothing" sourceRef="exclusivegateway1" targetRef="alfrescoUsertask1"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow6" sourceRef="exclusivegateway2" targetRef="endevent1"></sequenceFlow>
    <userTask id="alfrescoUsertask1" name="Alfresco Approve document" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:approvedTask"></userTask>
    <sequenceFlow id="flow7" sourceRef="alfrescoUsertask1" targetRef="exclusivegateway2"></sequenceFlow>
    <userTask id="Usertask2a" name="Alfresco Review document" 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><![CDATA[execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow8" sourceRef="usertask1" targetRef="exclusivegateway1">
      <extensionElements>
        <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[logger.log("Review User task Completed " + execution.getVariable('wf_reviewOutcome'));]]></activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
    </sequenceFlow>
    <serviceTask id="servicetask3" name="Prepare Approvers" activiti:class="sk.iway.eod.task.approversHelper"></serviceTask>
    <sequenceFlow id="flow9" sourceRef="servicetask3" targetRef="servicetask2"></sequenceFlow>
  </process>
</definitions>

 

Everything looks fine but when I check My tasks I see task "Alfresco Approve document" not "Review User Task".

Lookint into Workflow Details I see:

Type
Completed By
Date Completed
Outcome
Comment
Review
admin
Tue 28 Mar 2017 15:53:10
Rejected
Workflow Start Task
admin
Tue 28 Mar 2017 15:53:10
Task Done

I can do anything but first user task is always automatically "skipped".

Please help me.

Thanks in advance.

Outcomes