cancel
Showing results for 
Search instead for 
Did you mean: 

Send e-mail when person is assigned workflow

durrell
Champ in-the-making
Champ in-the-making
I've researched this and can't find a definitive answer. I'm sure it's fairly straight forward, but I just can't figure out the swimlanes and task events, blah blah blah.

Can anyone point me in the right direction? Basically I need:

Assign document to user for review > send user e-mail notifying them to check dashboard > click document from dashboard > accept or reject > end
47 REPLIES 47

thomasberment
Champ in-the-making
Champ in-the-making
Have you redeployed your workflow with the console workflow ?

See this : http://wiki.alfresco.com/wiki/Workflow_Console

thomasberment
Champ in-the-making
Champ in-the-making
I saw an error, you must put the transitions "je refuse le document" and "j'accepte le document" in a task node !

Like this :
<?xml version="1.0" encoding="UTF-8"?>
    <process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:customReview">

        <swimlane name="initiator" />
            
        <start-state name="start">
            <task name="wf:submitReviewTask" swimlane="initiator">
          </task>
             <transition name="" to="sendMailOK">
                <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                   <script>
                      <variable name="bpm_package" access="read" />
                      <variable name="statutDoc" access="read,write" />
                          <expression>
                            
                          </expression>
                      </script>
                </action>
             </transition>
        </start-state>
      
        <swimlane name="reviewer">
          <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
             <actor>#{bpm_assignee}</actor>
          </assignment>
       </swimlane>
      
           <node name="sendMailOK">
          <transition to="review">
             <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                   <script>
                      <variable name="bpm_package" access="read" />
                      <variable name="bpm_assignee" access="read" />
                      <variable name="initiator" access="read" />
                      <variable name="bpm_workflowDueDate" access="read" />
                      <expression>
                       
                       
                         <!– Send a notification email –>
                        var mail = actions.create("mail");
                        mail.parameters.to = bpm_assignee.properties.email;
                        mail.parameters.from = initiator.properties.email;
                        mail.parameters.subject = "Alfresco : proofreading task";
                   mail.parameters.text = "Hello, \n\n\t" + initiator.properties["cm:firstName"] + " " + initiator.properties["cm:lastName"] + " you to read the document " + bpm_package.children[0].properties["cm:title"] + ", version " + bpm_package.children[0].properties["cm:versionLabel"] + ", before validation.\n\n\tTime Replay : " + bpm_workflowDueDate + ". \n\n\tIn case of rejection of the document, thank you for adding your Record of Reading in the GOL and link with the document.\n\n\tRegards, the team Alfresco.";

                  mail.execute(bpm_package.children[0]);
                 
                      </expression>
                   </script>
                </action>
          </transition>
       </node>
      
      
       <task-node name="review">
            <task name="wf:reviewTask" swimlane="reviewer">
                <event type="task-create">
                  <script>
              <variable name="bpm_workflowDueDate" access="read" />
              <variable name="bpm_workflowPriority" access="read" />
              <expression>
                     if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                      if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                   </expression>
               </script>
                </event>
            </task>
          <transition name="Je refuse le document" to="rejected">
             <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                   <variable name="bpm_package" access="read" />
                   <variable name="bpm_assignee" access="read" />
                   <variable name="initiator" access="read" />
                       <expression>
                          <!– Send a notification email –>
                          var mail = actions.create("mail");
                           mail.parameters.to = initiator.properties.email;
                           mail.parameters.from = bpm_assignee.properties.email;
                           mail.parameters.subject = "Alfresco : Replay Denied";
                           mail.parameters.text = "Hello, \n\n\tYour request for the document editing " + bpm_package.children[0].properties["cm:title"] + ", was refused.\n\n\tRegards, the team Alfresco.";
                           mail.execute(bpm_package.children[0]);
                         </expression>
                </script>
             </action>
          </transition>
          
            <transition name="Je accepte le document" to="approved">
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                   <variable name="bpm_package" access="read" />
                   <variable name="bpm_assignee" access="read" />
                   <variable name="initiator" access="read" />
                       <expression>
                          <!– Send a notification email –>
                          var mail = actions.create("mail");
                           mail.parameters.to = initiator.properties.email;
                           mail.parameters.from = bpm_assignee.properties.email;
                           mail.parameters.subject = "Alfresco : Replay accepted";
                           mail.parameters.text = "Hello, \n\n\tYour request for the document editing " + bpm_package.children[0].properties["cm:title"] + ", was accepted.\n\n\tRegards, the team Alfresco.";
                           mail.execute(bpm_package.children[0]);
                         </expression>
                </script>
             </action>
            </transition>
        </task-node>
      
        <task-node name="rejected">
            <task name="wf:rejectedReviewTask" swimlane="initiator" />
            <transition name="" to="end">
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                   <variable name="bpm_package" access="read" />
                       <expression>
                         
                         </expression>
                </script>
             </action>
            </transition>
        </task-node>
      
        <task-node name="approved">
            <task name="wf:approvedReviewTask" swimlane="initiator" />
            <transition name="" to="end">
             <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                <script>
                   <variable name="bpm_package" access="read" />
                   <variable name="bpm_assignee" access="read" />
                       <expression>
                         
                         </expression>
                </script>
             </action>
            </transition>
        </task-node>

        <end-state name="end" >        
       </end-state>

    </process-definition>

sanket
Champ on-the-rise
Champ on-the-rise
Ok. I have placed your code in my review_processdefinition.xml.
I am following the steps as in http://wiki.alfresco.com/wiki/Workflow_Console

1. ok> deploy alfresco/workflow/review_processdefinition.xml
[WARNING] swimlane 'initiator' does not have an assignment
deployed definition id: jbpm$11 , name: jbpm$wf:customReview , title: wf:customReview , version: 3
definition: jbpm$11 , name: wf:customReview , version: 3
workflow: None
path: None

2.ok> var bpm:assignees* person admin,sanket
set var {http://www.alfresco.org/model/bpm/1.0}assignees = [workspace://SpacesStore/746061ab-d39f-4a92-9b0b-8854ae25ee1f, workspace://SpacesStore/b400a923-86c5-4e97…………

3.ok> start bpm:assignees
started workflow id: jbpm$39 , def: wf:customReview
path: jbpm$39-@ , node: start , active: true
task id: jbpm$67 , name: wf:submitReviewTask, title: Start Review , desc: Submit documents for review & approval , properties: 15
transition id: [default] , title: Task Done

4. ok> show transitions
path: jbpm$39-@ , node: start , active: true
task id: jbpm$67 , name: wf:submitReviewTask, title: Start Review , desc: Submit documents for review & approval , properties: 16
transition id: [default] , title: Task Done

5.ok> end task jbpm$67
org.alfresco.service.cmr.workflow.WorkflowException: 04060003 Mandatory task properties have not been provided: {http://www.alfresco.org/model/bpm/1.0}assignee,{http://www.alfresco.org/model/bpm/1.0}package

To receive the email, have I to follow all the steps mentioned in http://wiki.alfresco.com/wiki/Workflow_Console ?

I am getting the task on admin's dashboard. Now when I end the task from workflow console OR when I end the task from alfresco webclient (dashboard), I get this error: org.alfresco.service.cmr.workflow.WorkflowException: 04060003 Mandatory task properties have not been provided: {http://www.alfresco.org/model/bpm/1.0}assignee,{http://www.alfresco.org/model/bpm/1.0}package

Let me clarify. It is possible in Alfresco Community Edition also. Right ?

sanket
Champ on-the-rise
Champ on-the-rise
When I am starting a workflow wf:customReview on a document (thru alfresco webclient), at the last step of the wizard, I am getting this
error.
org.alfresco.service.cmr.workflow.WorkflowException: 04060005 Failed to signal transition 'null' from workflow task 'jbpm$68'

thomasberment
Champ in-the-making
Champ in-the-making
Excuse me sincerely, I forgot to copy all my code …

In Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco you have a file : web-client-config-propeties.xml, edit it.
Here you paste this code :
   <config evaluator="node-type" condition="wf:submitReviewTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
         <show-property name="bpm:workflowPriority" display-label-id="wf_review_priority" />
         <show-property name="bpm:workflowDueDate" display-label-id="wf_review_due_date" />
         <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
         <show-association name="bpm:assignee" display-label-id="wf_reviewer" />
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="wf:reviewTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
         <show-property name="bpm:comment" component-generator="TextAreaGenerator" />
      </property-sheet>
   </config>

   <config evaluator="node-type" condition="wf:rejectedReviewTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
         <show-property name="bpm:comment" component-generator="TextAreaGenerator" />
         <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
         <show-association name="bpm:assignee" display-label-id="wf_reviewer" read-only="true" />
      </property-sheet>
   </config>

<config evaluator="node-type" condition="wf:approvedReviewTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:taskId" />
         <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
         <show-property name="bpm:dueDate" read-only="true" />
         <show-property name="bpm:priority" read-only="true" />
         <show-property name="bpm:status" />
         <show-property name="bpm:comment" component-generator="TextAreaGenerator" />
         <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
         <show-association name="bpm:assignee" display-label-id="wf_reviewer" read-only="true" />
      </property-sheet>
   </config>

If you want customize your task, you can modify this code…

EDIT : it's not necessarily to follow all the steps mentioned in http://wiki.alfresco.com/wiki/Workflow_Console. And YES, it's possible to send an Email with Alfresco Community …

sanket
Champ on-the-rise
Champ on-the-rise
Well. When I reach the 5th step of http://wiki.alfresco.com/wiki/Workflow_Console (i.e end task jbpm$69)
I get this error.

A system error happened during the operation: 04060004 Mandatory task properties have not been provided: {http://www.alfresco.org/model/bpm/1.0}package.

I have copied ur code in web-client-config-properties.xml.
This time, I am only using the workflow-console. I have not touched the alfresco GUI/web-client.
I am logged in as admin.

thomasberment
Champ in-the-making
Champ in-the-making
Have you modify the file workflowModel.xml in "Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\workflow" ?

If no, copy and paste this code :
<type name="wf:submitReviewTask">
         <parent>bpm:startTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>

<type name="wf:reviewTask">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
      </type>

<type name="wf:approvedReviewTask">
         <parent>bpm:workflowTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>

      <type name="wf:rejectedReviewTask">
         <parent>bpm:workflowTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>

sanket
Champ on-the-rise
Champ on-the-rise
Yes I have modified workflowModel.xml file.

I am getting the same error.
When I am running workflow console, at the 5th step, when I run end task jbpm$71, I am getting this error.


org.alfresco.service.cmr.workflow.WorkflowException: 04070002 Mandatory task properties have not been provided: {http://www.alfresco.org/model/bpm/1.0}assignee,{http://www.alfresco.org/model/bpm/1.0}package

Still, there is something missing ??