cancel
Showing results for 
Search instead for 
Did you mean: 

Timer isnt working, Help!

bucklao
Champ in-the-making
Champ in-the-making
Hello,

I've implemented a timer in my workflow and it doesnt seem to be working.  What im trying to do is when a user approves a task then it moves to the DeptHead group task.  After a certain time of which there is no response an email notification gets triggered to the DeptHead group reminding them of the task.  Hopefully someone can shed some light on what im missing.

Here is my code:
<task-node name="deptHead review">
      
      <task name="scwf:deptHeadReview" swimlane="deptHead">
      <timer name="thirdPartyTimer" duedate="1 minutes">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
      <script>
            {
            var mail = actions.create("mail");
      mail.parameters.to = "sangbouasya@stancounty.com";
        mail.parameters.subject = "Timer is working!!!";
        mail.parameters.from = "alfresco@alfresco.com";
        mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_reject_admin.ftl");
        mail.parameters.text = "some text, in case template is not found";
        mail.execute(bpm_package);
            }
            </script>
      </action>
      </timer>  
      </task>
      <transition name="approve" to="end1">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
            {
            var mail = actions.create("mail");
      mail.parameters.to = "sangbouasya@stancounty.com";
        mail.parameters.subject = "Your P.O. Contract has been Approved by the Department Head";
        mail.parameters.from = "alfresco@alfresco.com";
        mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_reject_admin.ftl");
        mail.parameters.text = "some text, in case template is not found";
        mail.execute(bpm_package);
            }
            </script>
            </action>
      </transition>
      <transition name="reject" to="admin review"></transition>
   </task-node>
5 REPLIES 5

bucklao
Champ in-the-making
Champ in-the-making
Bump.  Anyone?

bucklao
Champ in-the-making
Champ in-the-making
Thanks for everyones help.  I found the problem.  :mrgreen:

bucklao
Champ in-the-making
Champ in-the-making
I've had a few PM's requesting to see the working timer code.  So I'm going to post my working processdefinition.xml file.  If anyone is interested let me know and i can supply all the other supplemental files.

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

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="scwf:POContract">
   <swimlane name="initiator" />

   <swimlane name="admin">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <pooledactors>#{people.getGroup('GROUP_admin')}</pooledactors>
      </assignment>
   </swimlane>
   
   <swimlane name="deptHead">      
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>departmentHead</actor>
      </assignment>
   </swimlane>

   <start-state name="start">
      <task name="scwf:submitReviewTask" swimlane="initiator" />
      <transition name="" to="submit"></transition>
   </start-state>
  
   <node name="submit">
      <event type="node-enter"></event>
      <transition name="" to="admin review">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
            {
               var mail = actions.create("mail");
         mail.parameters.to = "sangbouasya@stancounty.com";
           mail.parameters.subject = "Workflow has been Submitted to Admin Group";
           mail.parameters.from = "alfresco@alfresco.com";
           mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_reject_admin.ftl");
           mail.parameters.text = "some text, in case template is not found";
             mail.execute(bpm_package);
            }
            </script>
            </action>

      </transition>
   </node>
   

   <task-node name="admin review">
      <task name="scwf:adminReview" swimlane="admin" />
      <transition name="approve" to="deptHead review">
      
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
            {
               var mail = actions.create("mail");
         mail.parameters.to = "sangbouasya@stancounty.com";
           mail.parameters.subject = "Workflow has been submitted to Department Head";
           mail.parameters.from = "alfresco@alfresco.com";
           mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_approval_admin.ftl");
           mail.parameters.text = "some text, in case template is not found";
             mail.execute(bpm_package);
            }
            </script>
            </action>
            
      </transition>

      <transition name="reject" to="revise">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
            {
               var mail = actions.create("mail");
         mail.parameters.to = "sangbouasya@stancounty.com";
           mail.parameters.subject = "Workflow needs to be Revised";
           mail.parameters.from = "alfresco@alfresco.com";
           mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_reject_admin.ftl");
           mail.parameters.text = "some text, in case template is not found";
             mail.execute(bpm_package);
            }
            </script>
            </action>
      </transition>

   </task-node>
  
   <task-node name="deptHead review">
      
      <task name="scwf:deptHeadReview" swimlane="deptHead">
      <timer name="sendNotification" duedate="1 minutes" repeat="1 minutes">
          <action name="sendNotification" class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
      <script>
            {
         var mail = actions.create("mail");
         mail.parameters.to = "sangbouasya@stancounty.com";
           mail.parameters.subject = "Timer is working!!!";
           mail.parameters.from = "alfresco@alfresco.com";
           mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_reject_admin.ftl");
           mail.parameters.text = "some text, in case template is not found";
             mail.execute(bpm_package);
      }
            </script>
      </action>
      </timer>
      </task>

      <transition name="approve" to="end1">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
            {
               var mail = actions.create("mail");
         mail.parameters.to = "sangbouasya@stancounty.com";
           mail.parameters.subject = "Workflow has been Approved by the Department Head";
           mail.parameters.from = "alfresco@alfresco.com";
           mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_reject_admin.ftl");
           mail.parameters.text = "some text, in case template is not found";
             mail.execute(bpm_package);
            }
            </script>
            </action>
      </transition>
      <transition name="reject" to="admin review">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
            {
               var mail = actions.create("mail");
         mail.parameters.to = "sangbouasya@stancounty.com";
           mail.parameters.subject = "Workflow needs to be Revised by Admin Group";
           mail.parameters.from = "alfresco@alfresco.com";
           mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/wf_reject_admin.ftl");
           mail.parameters.text = "some text, in case template is not found";
             mail.execute(bpm_package);
            }
            </script>
            </action>
      </transition>

   </task-node>

  
   <task-node name="revise">
      <task name="scwf:revise" swimlane="initiator"></task>
      <transition name="submit" to="submit"></transition>
      <transition name="done" to="end1"></transition>
   </task-node>

   <end-state name="end1"></end-state>
  
</process-definition>

flaviuc
Champ in-the-making
Champ in-the-making
I want to implement an action that will send email to a group of users, if a certain type of document did not arrived into a folder (in Alfresco) after a certain amount of time. I know that Alfresco has this capability but I don't know how to implement it. Could you give me some guidelines on how to design and build this action, please? Do I need to use a work-flow or can I do it in a different way without using work-flow? Could you also tell me all the types of files that I need to write for this timer?

Thanks!

Regards,
Flaviu

cheffilet
Champ in-the-making
Champ in-the-making
I want to implement an action that will send email to a group of users, if a certain type of document did not arrived into a folder (in Alfresco) after a certain amount of time.

Easily to implement with JBPM. Following code gives you an overview about the JPDL-Code that handles the timer:

<task>

  <timer duedate="10 business hours">
    <action class="yourclassAction that implements an actionhandler">
       <var1>val1</var>
    </action>
  </timer>

</task>

After 10 business hours the action will be triggered so you can do what you want in your action-implementation like checking up spaces for documents or sending emails.

Do I need to use a work-flow or can I do it in a different way without using work-flow?

It depends on the business case - but you probably already know this 😉

Could you also tell me all the types of files that I need to write for this timer?

http://wiki.alfresco.com/wiki/Alfresco_Developer_Guide
http://docs.jboss.org/jbpm/v3/userguide/