AnsweredAssumed Answered

TImer (delay 3 days)

Question asked by gslamy on Jun 11, 2015
Latest reply on Jun 24, 2015 by gslamy
Hello everybody.

I want to add timer between startEvent and UserTask, i. e. timer before receiving task. How does it do?

[startEvent]-><strong>[delay 3 days]</strong>->[userTask]->[endEvent]



  <process id="helloWorldUI2" name="Hello World UI 2" isExecutable="true">

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

    <sequenceFlow id="flow1" sourceRef="start" targetRef="adhocTask"></sequenceFlow>

    <userTask id="adhocTask" name="Adhoc Task" activiti:assignee="${bpm_assignee.properties.userName}" activiti:formKey="wf:adhocTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
                      if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>

    <sequenceFlow id="flow2" sourceRef="adhocTask" targetRef="verifyTaskDone"></sequenceFlow>
    <userTask id="verifyTaskDone" name="Verify Adhoc Task Completed." activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:completedAdhocTask">
      <documentation>Verify the arbitrary task was completed.</documentation>
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
                        if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
                       
                        if (wf_notifyMe)
                     {
                        var mail = actions.create("mail");
                        mail.parameters.to = initiator.properties.email;
                        mail.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
                        mail.parameters.from = bpm_assignee.properties.email;
                        mail.parameters.text = "It's done";
                        mail.execute(bpm_package);
                     }]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow3" sourceRef="verifyTaskDone" targetRef="theEnd"></sequenceFlow>
    <endEvent id="theEnd"></endEvent>
  </process>

Outcomes