AnsweredAssumed Answered

Problem with custom workflow

Question asked by ivana.jeremic on Mar 4, 2008
Hi!
I have a problem configuring custom workflow.
I am using 2.10 community with MySQL 5.0 on Windows.

I used adhoc_processdefinition for my base workflow and tried to implement sending email when: adhoc task is started (to a group of users) and adhoc task is finished (to initiator and a group).

Here is my code. I basicly add code to existing xml.

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

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf: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 mail1 = actions.create("mail");
                 var gpeSender = new Array();
                
                 gpeSender[0]="GROUP_Rukovodioci";//Group of users to notify
                 mail1.parameters.to_many = gpeSender;
                 mail1.parameters.subject = "CREATED Adhoc Task " + bpm_workflowDescription;
                 mail1.parameters.from ="test@localhost.com";
                 mail1.parameters.text = "Task "+bpm_workflowDescription+" has created";
                 mail1.execute(bpm_package);
            </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">
      <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)
              {
                 var mail2 = actions.create("mail");
                 logger.log("var mail2 = actions.create("mail");!!!");
                 mail2.parameters.to = initiator.properties.email;
                 mail2.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
                 mail2.parameters.from = bpm_assignee.properties.email;
                 mail2.parameters.text = "It's done";
                 mail2.execute(bpm_package);
                
               }
                 var mail3 = actions.create("mail");
                 var gpeSender1 = new Array();
                 gpeSender1[0]="GROUP_Rukovodioci";//Group of users to notify
                 mail3.parameters.to_many = gpeSender1;
                 mail3.parameters.subject = "FINISHED Adhoc Task " + bpm_workflowDescription;
                 mail3.parameters.from = "proba@localhost.com";//bpm_assignee.properties.email;
                 mail3.parameters.text = "Task "+bpm_workflowDescription+" has ended";
                 mail3.execute(null);//(bpm_package);(bpm_package);
                
           </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>

Here are steps that I followed:
Alfresco was down.
I started alfresco with no errors and loged in.
I started wizard for new wokflow and follow steps in wizard.
When I pressed "Finish" button adhoc workflow is created.

I can see it in "My task TO DO" but I don't get email for users in group that i send mail.
There is no error in log file.

When i press "Task complete" i get mail only for the initiatior in te if(notify_me) block. Other code is supressed.

I used workflow-console to inspect definitions and i got this:


Last command: show definitions all
Duration: 125ms
—–
id: jbpm$4 , name: jbpm$wcmwf:changerequest , title: Change Request , version: 1
id: jbpm$3 , name: jbpm$wcmwf:submit , title: Web Site Submission , version: 1
id: jbpm$19 , name: jbpm$wf:adhoc , title: Adhoc Task , version: 1
id: jbpm$20 , name: jbpm$wf:review , title: Review & Approve , version: 1

When i use set of commands
undeploy definition name jbpm$wf:adhoc ,
deploy alfresco/workflow/adhoc_processdefinition.xml
and show definitions all


Last command: undeploy definition name jbpm$wf:adhoc
Duration: 3531ms
—–
undeploying… v1
id: jbpm$4 , name: jbpm$wcmwf:changerequest , title: Change Request , version: 1
id: jbpm$3 , name: jbpm$wcmwf:submit , title: Web Site Submission , version: 1
id: jbpm$20 , name: jbpm$wf:review , title: Review & Approve , version: 1

Last command: deploy alfresco/workflow/adhoc_processdefinition.xml
Duration: 515ms
—–
[WARNING] swimlane 'initiator' does not have an assignment
deployed definition id: jbpm$21 , name: jbpm$wf:adhoc , title: Adhoc Task , version: 1
definition: jbpm$21 , name: Adhoc Task , version: 1
workflow: None
path: None

Last command: show definitions all
Duration: 94ms
—–
id: jbpm$4 , name: jbpm$wcmwf:changerequest , title: Change Request , version: 1
id: jbpm$3 , name: jbpm$wcmwf:submit , title: Web Site Submission , version: 1
id: jbpm$21 , name: jbpm$wf:adhoc , title: Adhoc Task , version: 1
id: jbpm$20 , name: jbpm$wf:review , title: Review & Approve , version: 1

When i tried to create another workflow (with no errors) I again don't get mail for starting task.

Can anyone comment on my problem?

I even tried to remove code from <start-task> to another task and still don't work!


Thanks!

Outcomes