cancel
Showing results for 
Search instead for 
Did you mean: 

How to end all tasks of a parallel workflow

webfrank
Champ in-the-making
Champ in-the-making
Hi, I've created a parallel workflow and I would like to end all not completed tasks if one user reject the document.

To be more precise I have a fork node, "n" approve/reject tasks, one join node. If a user reject the document I don't want to wait for the other users to approve/reject but I want to end their tasks and proceed to reject node directly.

I tried different approches in beanshell and javascript but no one seems to work, I have always a ended workflow with opened tasks.

I'm using 4.0d and I would like to use javascript inside jPDL if possible.
5 REPLIES 5

yogeshpj
Star Contributor
Star Contributor
Hi webfrank,

     You need to call an action class when any user does any transition for forked task.
In that action class check weather user has rejected or approved. If it is rejected then find all the workflow paths for that workflow and filter the workflow paths by removing node task and current task. Finally end those filtered task by coding with appropriate transition.

Thanks ,
Yogesh Prajapati

webfrank
Champ in-the-making
Champ in-the-making
Hi,
   thanks for explanation but as I'm not so experienced with Alfresco could you post or tell me some example? Is it possible to do it in javascript from inside workflow definition?

yogeshpj
Star Contributor
Star Contributor
Hi webfrank,

   I have tried this using action class.I have not tried that using javascript inside workflow defination.Here is the overview what i have did.
–Get all the workflow paths of the the current workflow using workflow service.
–Filter the workflow paths by removing node task and current task by comparing node title and current path id.
–Iterate each workflow path , get all the workflow tasks of that path and end that task.


Thanks ,
YogeshPJ

webfrank
Champ in-the-making
Champ in-the-making
Hi,
   I found I could get the workflow instance in javascript inside workflow action using:


var doc = bpm_package.children[0];
var wf = doc.activeWorkflows;

this way wf is a JscriptWorkflowInstance and from documentation I could call cancel on it:

wf.cancel();

but I receive error 500, same thing using:

wf['delete']();
.

What I want to active is to terminate a parallel workflow once a reviewer reject the document without waiting for the other reviewers to accomplish their task.

Any help (with code) is really appreciated.

webfrank
Champ in-the-making
Champ in-the-making
Hi,
   anyone has an idea on how to end (cancel) pending
tasks when a parallel workflow ends (without waiting other activities)?