cancel
Showing results for 
Search instead for 
Did you mean: 

Approve and reject as a part of a workflow

fbehfar
Champ on-the-rise
Champ on-the-rise
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
5 REPLIES 5

rob562435
Champ in-the-making
Champ in-the-making
First a question: when you look in the task overview what status information is given to the taks, in other words on which tasknode the task has arrived?

Rgrds, Rob

rob562435
Champ in-the-making
Champ in-the-making
Next I think the problem is the fact that you coded the decision node as a task node. The decision node needs a condition to decide which branch to take. What you should do is remove the decision node and add the two transition definitions to the Notify CCM tasknode, as follows:
   <task-node name="Notify CCM"> 
      <task name="crwf:CCManagerReview" swimlane="CCM"></task>
      <transition name="Not approved" to="Notify Customer"></transition>
      <transition name="Approved" to="Notify Analysis"></transition>
   </task-node>
You do not need a decision node in this case.
(You may modify the task naming to your needs of course, this is only to show how to…)
In case you use a decision node you have to add conditions otherwise the decision node does not work. The decision node is a background "task" that never results in buttons for users. In case a user has to decide this should be implemented as normal task nodes with multiple branches (transitions).

Hope this helps….

Rgrds, Rob

fbehfar
Champ on-the-rise
Champ on-the-rise
Hi,
Thanks Rob,
well let me explain you my workflow:
a user uploads a content, by uploading, the workflow will start on that content:
1. CCM(Change and Configuration Manager) recieves a task on his task to do list
2. by opening the task he sees a description of the task and the he should review the uploaded document
3. after reading the document, he decides to approve or reject the document (it's a change request document)
4. if he approves the document then a pool task will added to the Analysis group pool task list
5. if he rejects the document then the uploader of the document will recieve a task or a notification of rejection
.
.
.
.
I don't know how to implement this, actually I need a Approve/Reject buttons to do it, but I don't know how!!!! do I have to change anything else in my workflow or model???

Thank you again,
FSB

fbehfar
Champ on-the-rise
Champ on-the-rise
Hi rob,
I could finaly implement it.
but another question, if a task was defined as a pool task, and then the first one who takes the task, how can I have his ID (the owner ID). actually I want to define a swimlane as an owner and assign some task to the owner (how took the task from the pool task list)
I have tried all these but they don't work!!!

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

   <swimlane name="Owner">
   <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
   <actor>#{person.properties["cm:owner"]}</actor>
   </assignment>
   </swimlane>

thank you in advanced,
FSB

rob562435
Champ in-the-making
Champ in-the-making
Hi there,

Sorry I did not (in time) reacted on your previous question.
About the question you put here I can only give you a hint on the way I set up the assignments without swimlanes. Swimlanes are predefined and as far as I know do not work well with variables in the way I guess you want to.

As an example: I defined for the various roles a variable (multiple) that is filled with the information needed in an assignment. The assignment would look like:
 <task-node name="reAssignNeeded">
  <task name="qcp:reAssignNeeded">
   <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
    <actor>#{qcp_processManager}</actor>
   </assignment>
The varialbe is given a value with code like:
   <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
    <script>
     <variable name="qcp_processManager" access="write"/>
     <variable name="bpm_package" access="read"/>
     <expression>
      qcp_processManager = people.getPerson(bpm_package.children[0].properties["qcp:processManagerRole"]);
     </expression>
    </script>
   </action>
In your case the variable would be given the value of the "owner" (in case the current user: "person" would do, see also the JavaScript API WIKI http://wiki.alfresco.com/wiki/JavaScript_API).
After the variable is given the name of the current user an automated transition must be performed to the next task node with the assignment as shown above.

I hope this helps.

Rgrds, Rob
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.