cancel
Showing results for 
Search instead for 
Did you mean: 

Timer in Workflow

molti
Champ in-the-making
Champ in-the-making
Hello.
For examle in  proccess definition i have such timer

<timer name="task_timer" duedate="#{daa_finishDate}" repeat="4 days">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
      <runas>admin</runas>
      <script>

            logger.log("Send Email");
      </script>
      </action>
</timer>  
daa_finishDate = bpm_workflowDueDate - 5 days.
If today 26.09.2011 and bpm_workflowDueDate= 28.09.2011.
Expected result
I'll get the mail 27.09.2011,then after 4 days another … while task is not finished
Getting result
I'll get the mail 27.09.2011 and task automaticly closed…
What is wrong?
5 REPLIES 5

molti
Champ in-the-making
Champ in-the-making
I found the reason and the poblem
If I put timer into the task-node All be right
but if i put into task it works incorrectly.

supta
Champ in-the-making
Champ in-the-making
Hi Molti,

I'm trying the same thing. Where did you put the variable "daa_finishDate" ?

Is it really working without defining the transition in timer ?

Thank you.

molti
Champ in-the-making
Champ in-the-making
Yes, it's working good.
I define "daa_finishDate" in transaction  which goes to the task-node in which the timer is declared

supta
Champ in-the-making
Champ in-the-making
Thank you for your reply.

I'm trying to edit Alfresco Adhoc task so that it send an email to assignee when it's due in 3 days. I can make the timer works when it uses absolute duedate eg: duedate="2 minutes" but fails when it uses my variable duedate=#{reminderDate}. I think I define the variable incorrectly. Hope you can share your thoughts.

This is my edited Adhoc task:


<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="pti:adhoc">

    <swimlane name="initiator"/>

    <start-state name="start">
        <task name="wf:submitAdhocTask" swimlane="initiator"/>
        <transition name="" to="adhoc">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                    var reminderDate = bpm_workflowDueDate - 3 days;
                </script>
            </action>
        </transition>
    </start-state>

    <swimlane name="assignee">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{bpm_assignee}</actor>
        </assignment>
    </swimlane>

    <task-node name="adhoc">
        <timer name="emailReminderTimer" duedate="#{reminderDate}">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                    logger.log("send email");
                </script>
            </action>
        </timer>
        <task name="wf:adhocTask" swimlane="assignee">
            <event type="task-create">
                <script>
                    if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                    if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                </script>
            </event>
        </task>
        <transition name="" to="completed">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                    if (wf_notifyMe)
                    {
                    logger.log("send email");
                    }
                </script>
            </action>
        </transition>
   </task-node>

    <task-node name="completed">
        <task name="wf:completedAdhocTask" swimlane="initiator"/>
        <transition name="" to="end"/>
    </task-node>

    <end-state name="end"/>

</process-definition>

molti
Champ in-the-making
Champ in-the-making
Hello! Try this
<start-state name="start">
        <task name="wf:submitAdhocTask" swimlane="initiator"/>
        <transition name="" to="adhoc">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                    var reminderDate = = new java.util.Date();
futureDate.setTime(futureDate.getTime());
   futureDate.setDate(futureDate.getDate() + 3);
                </script>
            </action>
        </transition>
    </start-state>