cancel
Showing results for 
Search instead for 
Did you mean: 

Task Completed

lucille_arkenst
Champ in-the-making
Champ in-the-making
Is there a way to issue a "task completed" command from a parallel-review workflow (process definition)?
I want to be able to "end" the workflow after a certain number of people have reviewed it.
This way it comes off everyone else's queue.

Thank you!  In advance
8 REPLIES 8

vinaxwater
Champ in-the-making
Champ in-the-making
Dear friend,

You can use parameter in workflow process (ex: wf_countReviewer), then check that parameter for action end workflow, You can search in this forum!

Good luck!
vinaxwater

lucille_arkenst
Champ in-the-making
Champ in-the-making
Thank you, vinaxwater… but I am already doing that, and it is ignoring the count.  I modified parallelreview_group_processdefinition.xml.  The code says transition to approved when the approve count is 2.  But all it does is it sets the "outcome" of the workflow to approved.  It doesn't signal the token to move to the end.

Help…


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

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

    <swimlane name="initiator"></swimlane>

    <start-state name="start">
        <task name="wf:submitGroupReviewTask" swimlane="initiator" />
        <transition name="" to="startreview"/>
    </start-state>

    <node name="startreview">
        <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
            <foreach>#{people.getMembers(bpm_groupAssignee)}</foreach>
            <var>reviewer</var>
        </action>
        <event type="node-enter">
            <script>
                <variable name="wf_approveCount" access="write" />
                <expression>
                    wf_approveCount = 0;
                </expression>
            </script>
        </event>
        <transition name="review" to="review" />
    </node>

    <task-node name="review">
        <task name="wf:reviewTask">
            <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
               <actor>#{reviewer}</actor>
            </assignment>
            <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="reject" to="endreview" />
        <transition name="approve" to="endreview">
            <script>
                <variable name="wf_approveCount" access="read,write" />
                <expression>
                    wf_approveCount = wf_approveCount +1;
                 </expression>
            </script>
        </transition>
    </task-node>

    <join name="endreview">
        <transition to="isapproved" />
    </join>

    <decision name="isapproved">
        <transition name="reject" to="rejected" />
        <transition name="approve" to="approved">
         <condition>#{wf_approveCount == 2}</condition>
        </transition>
    </decision>
              
    <task-node name="rejected">
        <transition to="end" />
    </task-node>

    <task-node name="approved">
        <transition to="end" />
    </task-node>

    <end-state name="end"/>

</process-definition>

lucille_arkenst
Champ in-the-making
Champ in-the-making
I even removed a step, and it still doesn't end.  What the heck is going on?

    <join name="endreview">
        <transition to="isapproved" />
    </join>

    <decision name="isapproved">
        <transition name="reject" to="rejected" />
        <transition name="approve" to="end">
         <condition>#{wf_approveCount == 1}</condition>
        </transition>
    </decision>
              
    <end-state name="end"/>

lucille_arkenst
Champ in-the-making
Champ in-the-making
I figured out that it never gets to this point until all reviewers in the group have reviewed it.  So we are back to square 1.  How do I trigger an "end"?

<decision name="isapproved">

vinaxwater
Champ in-the-making
Champ in-the-making
Dear friend,
I remember when develop alfresco's workflow for my process, i have this problem. That's in join must check for both transition to approve task and reject task, I can idea edit your code:


<task-node name="review">
        <task name="wf:reviewTask">
            <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
               <actor>#{reviewer}</actor>
            </assignment>
            <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="reject" to="endreview" >
            <script>
                <variable name="wf_approveCount" access="read,write" />
                <expression>
                    wf_approveCount = 0;
                 </expression>
            </script>
        </transition>
        <transition name="approve" to="endreview">
            <script>
                <variable name="wf_approveCount" access="read,write" />
                <expression>
                    wf_approveCount = wf_approveCount +1;
                 </expression>
            </script>
        </transition>
    </task-node>

    <join name="endreview">
        <transition to="isapproved" />
    </join>

    <decision name="isapproved">
        <transition name="reject" to="rejected" >
        <condition>#{wf_approveCount == 0}</condition>
        </transition>
        <transition name="approve" to="approved">
         <condition>#{wf_approveCount == 2}</condition>
        </transition>
    </decision>
              
    <task-node name="rejected">
        <transition to="end" />
    </task-node>

    <task-node name="approved">
        <transition to="end" />
    </task-node>

    <end-state name="end"/>


It's work fine in my system. You can debug with logger.log(wf_approveCount); for check value wf_approveCount in process.

Goodluck.

lucille_arkenst
Champ in-the-making
Champ in-the-making
Dear friend,

Thanks!  Also – Where does logger.log end up logging to?  And do I have to change any settings to get logger to work?

Smiley Very Happy

lucille_arkenst
Champ in-the-making
Champ in-the-making
Dear friend,

Sorry I guess I didn't explain correctly.  Let's say there are 3 reviewers.  As soon as 2 people approve, I want the workflow to end… I don't want it to remain in the 3rd person's task list.  When I run the code with your changes, it doesn't work the way I would like it to.
What version of Alfresco are you using?  I wonder if that makes a difference.

Thanks

vinaxwater
Champ in-the-making
Champ in-the-making
Dear friend,
I use version alfresco 2.9B, it's build from source in SVN. The workflow work fine it's have conditions in process.

Goodluck.
vinaxwater