cancel
Showing results for 
Search instead for 
Did you mean: 

How to recycle the advanced workflow on rejecting the doc

harishns
Champ in-the-making
Champ in-the-making
Hi,

I am new to writing JPDL, I want to redo the review process with the same person as reviewer with updated document.
is anyone know how to write restart the workflow upon rejecting the document?

if I am not clear, this is how my workflow should be

start advance workflow –> reject the document in review process –> resend the updated document to the same person for approve/reject –> perform same operation till document get approve.

there is one reassign action which I can use it in alfresco webclient, if I did that, I don't get option to update the document and I get 'Task Done' button instead of approve/reject option on the reviewer side.

Can anyone helpme out in modifying the review-processdefinition.xml .

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:review">

    <swimlane name="initiator" />

    <start-state name="start">
        <task name="wf:submitReviewTask" swimlane="initiator" />
        <transition to="review" >
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <runas>admin</runas>
         </action>
         <script>
              var mail = actions.create("mail");
              mail.parameters.to = bpm_assignee.properties.email;
              mail.parameters.subject = "new Review Task";
              mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/notify_user_email.ftl");
              mail.parameters.text = "A document awaiting your approval at Alfresco";
              mail.execute(bpm_package.children[0]);
         </script>
      </transition>
    </start-state>

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

    <task-node name="review">
        <task name="wf:reviewTask" swimlane="reviewer">
            <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="approve" to="approved" />
        <transition name="reject" to="rejected" />
    </task-node>

    <task-node name="rejected">
        <task name="wf:rejectedTask" swimlane="initiator" />
        <transition name="" to="end" />
    </task-node>

    <task-node name="approved">
        <task name="wf:approvedTask" swimlane="initiator" />
        <transition name="" to="end" />
    </task-node>

    <end-state name="end" />


   <script></script>

</process-definition>

Thanks
3 REPLIES 3

sebp
Champ in-the-making
Champ in-the-making
First in alfresco/workflow/review_processdefinition.xml you have to add a transition from the rejected task-node to the review task-node like this:


<task-node name="rejected">
        <task name="wf:rejectedTask" swimlane="initiator" />
         <transition name="review_again" to="review"/>
        <transition name="" to="end" />
    </task-node>

This should send the same document to the same reviewer. If the initiator should be able to change the workflow package documents in the rejected task you have to change the type definition of the wf:rejectedTask in the workflowModel.xml file to:


    <type name="wf:rejectedTask">
         <parent>bpm:workflowTask</parent>
         <overrides>
             <property name="bpm:packageActionGroup">
                 <default>add_package_item_actions</default>
             </property>
             <property name="bpm:packageItemActionGroup">
                 <default>start_package_item_actions</default>
             </property>
         </overrides>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>

After all these changes don't forget to redeploy the Review & Approve workflow definition. In bootstrap-context.xml set redeploy to true for alfresco/workflow/review_processdefinition.xml

harishns
Champ in-the-making
Champ in-the-making
Hi,
it worked for me, I have created new node with relevant details and found working as expected except lables which I need to find a place to add.

Thank you very much Smiley Happy

I will request one more thing is like, can you please guide me on best possible way to learn to write different workflows using jPDL by referring some documentation, I am finding little difficult in understanding jBPM and Alfresco implementation. so please help me

Thanks again Smiley Happy

sebp
Champ in-the-making
Champ in-the-making
I also started with workflows only one month ago. I found it very difficult too. The following docs were useful:

Of course the workflow wiki:
http://wiki.alfresco.com/wiki/WorkflowAdministration

The jBPM 3.2 user guide
http://docs.jboss.com/jbpm/v3.2/userguide/html/

The forums on the jboss jbpm site were also very helpful. Many questions I came across have already been asked and answered there.
The jbpm designer for Eclipse was also a big help in the beginning.
There are lot of good Alfresco tutorials (also workflow) on  http://ecmarchitect.com/alfresco-developer-series

So for me this workflow stuff was and still is a lot of trial and error with a miserable learning curve. Maybe someone else knows some good documentation?