cancel
Showing results for 
Search instead for 
Did you mean: 

How do I end a workflow in Alfresco

darryl_staflund
Champ in-the-making
Champ in-the-making
Hi all,

I have to model an advanced worklow in Alfresco that lets the workflow initiator cancel the workflow regardless of what task is currently being performed or who has been assigned the task.  I thought that selecting 'Cancel Workflow' from My Alfresco might do the trick, but this deletes the workflow from the system, whereas I only want to transition the workflow to an end-state.  How can I do this in Alfresco?

After reading the jBPM documentation, I thought that maybe I could do the following:


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

    <start-state name="start">
        <transition to="fork" />
    </start>

    <fork name="fork">
        <transition to="continue_workflow" />
        <transition to="await_cancellation" />
    </fork>

    <task-node name="continue_workflow">
        <task name="exwf:continueTask" />
        <transition to="join" />
    </task-node>

    <task-node name="await_cancellation">
        <task name="exwf:cancelTask" swimlane="initiator" />
        <transition to="join" />
    </task-node>

    <join name="join" multiplicity="1">
        <transition to="end" />
    </join>

    <end-state name="end" />

</processdefinition>

The 'multiplicity' attribute of the <join /> task is key to this strategy.  The <fork /> activity starts two concurrent execution branches – one for the workflow, the other for cancellation – while the <join multiplicity="1" /> activity transitions the workflow to an end-state when 1 of the two execution paths (workflow path or cancellation path) make their way to the <join /> activity.

Since Alfresco's <join /> task doesn't support the 'multiplicity' attribute (according to Eclipse's sytax highlighting anyway), I can't adopt this approach.  So is there another way in Alfresco to do what I need to do?

Thanks,
Darryl
2 REPLIES 2

norgan
Champ in-the-making
Champ in-the-making
Hi,
how about this :
Make a fork, let the one branch wait for "(cancel by initiator) or (~done-flag~ == true)" (evaluation every 5 minutes and on every "node-leave" event. On the second branch, "last node:transition-leave", do "set done-flag = true".  Let both run into the "END" state, and drop the join.

Norgan

darryl_staflund
Champ in-the-making
Champ in-the-making
Thanks Norgan, I will give this a try.