AnsweredAssumed Answered

Approve and reject as a part of a workflow

Question asked by fbehfar on Feb 9, 2008
Latest reply on Feb 15, 2008 by rob562435
Hi,

I'm trying to deploy a workflow, in some part of it, it needs to have a Approve/Reject workflow. this workflow will be automatically started when a content upload, then a notification will be sent to a specified user, this user should read the content (or if it was necessary update it) then he should be able to approve or reject it. by rejecting it will send a notification to the uploader and by approving it, it will send the task to a group of user as a pool task.
my problem: the workflow will start automatically and the first user recieves the task, but he can not approve/reject it, actually he sees no approve or reject bottun. how can I implement it????

this is my model:
……………….
   <types>

      <type name="crwf:SubmitChangeRequestTask">
         <parent>bpm:startTask</parent>
         <mandatory-aspects>
            <aspect>crwf:thirdPartyReviewable</aspect>
         </mandatory-aspects>
      </type>

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

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

      <type name="crwf:CCMApproved">
          <parent>bpm:workflowTask</parent>
          <mandatory-aspects>
             <aspect>bpm:groupAssignee</aspect>
          </mandatory-aspects>         
      </type>   
      
      <type name="crwf:AnalysisReview">
         <parent>bpm:workflowTask</parent>
         <overrides>
                      <property name="bpm:packageItemActionGroup">
                           <default>read_package_item_actions</default>
                     </property>                  
                  </overrides>   
      </type>      
      
      <type name="crwf:AnalysisCompleted">
         <parent>bpm:workflowTask</parent>
         <overrides>
                  <property name="bpm:packageActionGroup">
                     <default>add_package_item_actions</default>
                  </property>
              </overrides>   
      </type>      
      
      <type name="crwf:AnalysisNotCompleted">
         <parent>bpm:workflowTask</parent>
         <overrides>
             <property name="bpm:packageActionGroup">
                <default>add_package_item_actions</default>
             </property>
             <property name="bpm:packageItemActionGroup">
                <default>edit_package_item_actions</default>
             </property> 
              </overrides>             
            <mandatory-aspects>
               <aspect>crwf:mySuggestion</aspect>
            </mandatory-aspects>  
      </type>
      
      <type name="crwf:DeveloperReview">
         <parent>bpm:workflowTask</parent>
         <overrides>
                      <property name="bpm:packageItemActionGroup">
                           <default>read_package_item_actions</default>
                     </property>                  
                  </overrides>   
      </type>      
      
      <type name="crwf:DeveloperCompleted">
         <parent>bpm:workflowTask</parent>
         <overrides>
                  <property name="bpm:packageActionGroup">
                     <default>add_package_item_actions</default>
                  </property>
              </overrides>   
      </type>      
      
      <type name="crwf:DeveloperNotCompleted">
         <parent>bpm:workflowTask</parent>      
         <overrides>
             <property name="bpm:packageActionGroup">
                <default>add_package_item_actions</default>
             </property>
             <property name="bpm:packageItemActionGroup">
                <default>edit_package_item_actions</default>
             </property>    
              </overrides>             
            <mandatory-aspects>
               <aspect>crwf:mySuggestion</aspect>
            </mandatory-aspects>                 
      </type>

      <type name="crwf:TesterReview">
         <parent>bpm:workflowTask</parent>
         <overrides>
                      <property name="bpm:packageItemActionGroup">
                           <default>read_package_item_actions</default>
                     </property>                  
                  </overrides>   
      </type>      
      
      <type name="crwf:TesterAccepted">
         <parent>bpm:workflowTask</parent>
         <overrides>
                  <property name="bpm:packageActionGroup">
                     <default>add_package_item_actions</default>
                  </property>
              </overrides>   
      </type>      
      
      <type name="crwf:TesterRejected">
         <parent>bpm:workflowTask</parent>
         <overrides>
                  <property name="bpm:packageActionGroup">
                     <default>add_package_item_actions</default>
                  </property>   
         </overrides>                 
      </type>   
      
      <type name="crwf:CCMAssignment">
         <parent>bpm:workflowTask</parent>
               <mandatory-aspects>
                  <aspect>bpm:assignee</aspect>
               </mandatory-aspects>                  
      </type>      
   </types>
   
   <aspects>
      <aspect name="crwf:thirdPartyReviewable">
         <title>Someco Third Party Reviewable</title>
         <properties>
            <property name="crwf:reviewerEmail">
               <type>d:text</type>
               <mandatory>false</mandatory>
               <multiple>false</multiple>
            </property>
         </properties>
      </aspect>
      
      <aspect name="crwf:mySuggestion">
         <title>The person suggestion for assignee</title>
         <properties>
            <property name="crwf:mySugg">
               <type>d:text</type>
               <mandatory>false</mandatory>
               <multiple>false</multiple>
            </property>
         </properties>
      </aspect>      
   </aspects>
</model>

this is my workflow:
<?xml version="1.0" encoding="UTF-8"?>

<process-definition
  xmlns="urn:jbpm.org:jpdl-3.1"  name="crwf:ChangeRequestProcess">
   <swimlane name="Initiator" />
   <swimlane name="CCM">
   <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
   <actor>#{people.getPerson("CCM")}</actor>
   </assignment>
   </swimlane>
   <swimlane name="Analysis">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <pooledactors>#{people.getGroup('GROUP_Analysis')}</pooledactors>
      </assignment>  
   </swimlane>
   <swimlane name="Developer">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <pooledactors>#{people.getGroup('GROUP_Developer')}</pooledactors>
      </assignment>  
   </swimlane>
   <swimlane name="Tester">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <pooledactors>#{people.getGroup('GROUP_Tester')}</pooledactors>
      </assignment>  
   </swimlane>
   <start-state name="start">
      <task name="crwf:SubmitChangeRequestTask" swimlane="Initiator"></task>
      <transition name="" to="Notify CCM"></transition>
   </start-state>
   <task-node name="Notify CCM">
      <task name="crwf:CCManagerReview" swimlane="CCM"></task>
      <transition name="" to="Approved?"></transition>
   </task-node>
   <decision name="Approved?">
      <transition name="No" to="Notify Customer"></transition>
      <transition name="Yes" to="Notify Analysis"></transition>
   </decision>
   <task-node name="Notify Customer">
      <task name="crwf:CCMRejected" swimlane="Initiator"></task>
      <transition name="" to="end1">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
                 var mail = actions.create("mail");
                 mail.parameters.to = initiator.properties.email;
                 mail.parameters.subject = "Change Request Rejected";
                 mail.parameters.from = bpm_assignee.properties.email;
                 mail.parameters.text = "This document is rejected. For more information refer to the Comment part.";
                 mail.execute(bpm_package);
           </script>
         </action>     
      </transition>
   </task-node>
   <end-state name="end1"></end-state>
   <task-node name="Notify Analysis">
      <task name="crwf:CCMApproved" swimlane="Initiator"></task>
      <transition name="" to="Analysis Review"></transition>
   </task-node>
   <decision name="Completed?">
      <transition name="No" to="Notify CCM with Suggestion"></transition>
      <transition name="Yes" to="Notify Developer"></transition>
   </decision>
   <task-node name="Notify CCM with Suggestion">
      <task name="crwf:AnalysisNotCompleted" swimlane="Analysis"></task>
      <transition name="" to="Assign next one"></transition>
   </task-node>
   <task-node name="Notify Developer">
      <task name="crwf:AnalysisCompleted" swimlane="Analysis"></task>
      <transition name="" to="Developer Review"></transition>
   </task-node>
   <decision name="completed?">
      <transition name="Yes" to="Notify Tester"></transition>
      <transition name="No" to="Notify CCM with suggestion"></transition>
   </decision>
   <task-node name="Notify Tester">
      <task name="crwf:DeveloperCompleted" swimlane="Developer"></task>
      <transition name="" to="Tester Review"></transition>
   </task-node>
   <decision name="Accepted?">
      <transition name="Yes" to="Status completed"></transition>
      <transition name="No" to="Notify Developer"></transition>
   </decision>
   <task-node name="Status completed">
      <task name="crwf:TesterAccepted" swimlane="Tester"></task>
      <transition name="" to="end2"></transition>
   </task-node>
   <end-state name="end2"></end-state>
   <task-node name="Notify CCM with suggestion">
      <task name="crwf:DeveloperNotCompleted" swimlane="Developer"></task>
      <transition name="" to="Assign next  one"></transition>
   </task-node>
   <task-node name="Assign next one">
      <task name="crwf:CCMAssignment" swimlane="CCM"></task>
      <transition name="" to="Completed?"></transition>
   </task-node>
   <task-node name="Assign next  one">
      <task name="crwf:CCMAssignment" swimlane="CCM"></task>
      <transition name="" to="completed?"></transition>
   </task-node>
   <task-node name="Analysis Review">
      <task name="crwf:AnalysisReview" swimlane="Analysis"></task>
      <transition name="" to="Completed?">
         <script>
            <variable name="mySugg" access="read,write"/>
            <expression>
               mySugg = workflow.parameters["crwf:mySuggestion"];
               initiator.properties["crwf:mySuggestion"];
            </expression>
         </script>    
      </transition>
   </task-node>
   <task-node name="Developer Review">
      <task name="crwf:DeveloperReview" swimlane="Developer"></task>
      <transition name="" to="completed?"></transition>
   </task-node>
   <task-node name="Tester Review">
      <task name="crwf:TesterReview" swimlane="Tester"></task>
      <transition name="" to="Accepted?"></transition>
   </task-node>
</process-definition>

any help will be appriciated,
thank you in advanced,
FSB

Outcomes