AnsweredAssumed Answered

TimerStartEvent - How to set an Initiator

Question asked by bprado on Mar 5, 2013
Latest reply on Mar 15, 2013 by bprado
Hi all,

I'm new to Alfresco and Activiti and after some digging was finally able to create, deploy and redeploy advanced custom workflows created with Activiti designer plug in for eclipse.
Unfortunately I had problems working with "TimerStartEvent". The TimerEventDefiniton worked as expected, and all my workflows were created "on time". My workflow, however, had incomplete properties, and "initiator" was missing. As a consequence, the tasks won't show in MyTasks (error in JavaScript) and tasks cannot be ended (error in log).
From what I could figure, If I could set the initiator of the workflow, everything would work as expected. Please notice that I tried setting activiti:initiator on StartEvent without success.

Any advice would be appreciated.

Alfresco version is 4.2.b (since 4.2.c is giving me errors when using custom workflows)

fcteste1.bpmn


<?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="fcteste1" name="fcteste1" isExecutable="true">
    <startEvent id="timerstartevent1" name="Timer start" activiti:initiator="bruno">
      <timerEventDefinition>
        <timeCycle>R5/PT1M</timeCycle>
      </timerEventDefinition>
    </startEvent>
    <userTask id="usertask1" name="Timer Task" activiti:assignee="bruno" activiti:candidateUsers="bruno,teste" activiti:formKey="wf:adhocTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>logger.log("Timed task created as expected");</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow1" sourceRef="timerstartevent1" targetRef="usertask1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow2" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_fcteste1">
    <bpmndi:BPMNPlane bpmnElement="fcteste1" id="BPMNPlane_fcteste1">
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="340.0" y="280.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="timerstartevent1" id="BPMNShape_timerstartevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="100.0" y="280.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="180.0" y="270.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="135.0" y="297.0"></omgdi:waypoint>
        <omgdi:waypoint x="180.0" y="297.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="285.0" y="297.0"></omgdi:waypoint>
        <omgdi:waypoint x="340.0" y="297.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>


Log of error when trying to finish the task:


Mar 05, 2013 2:52:56 PM org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
org.activiti.engine.ActivitiException: Exception while invoking TaskListener: 02053124 Mandatory task properties have not been provided! {http://www.alfresco.org/model/bpm/1.0}package


Javascript error on MyTasks:



["bpm_status"]),y=z.getData("owner"),v=c(z.getData("description")),l=c(q.initiator.firstName);var


Uncaught TypeError: Cannot read property 'firstName' of null



Description of workflow using workflow-console (initiator is null and shouldn't)


desc workflow activiti$840

definition: activiti$fcteste1
id: activiti$840
description: null
active: true
start date: Tue Mar 05 13:25:48 UTC 2013
end date: null
initiator: null
context: null
package: null

Outcomes