AnsweredAssumed Answered

How do I end a workflow in Alfresco

Question asked by darryl_staflund on Sep 18, 2009
Latest reply on Sep 23, 2009 by darryl_staflund
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

Outcomes