In a workflow, I would like to know if it's possible in a task to kill another task that is already in a worklist.
Example of a workflow: Task 1 send data to Task 2 and Task 3 simultanously. User process task 3 and send data to task 4. Because Task 3 has been completed, I would like to kill Task 2 from the worklist.
I know that I should use the ProcessInstanceId to select the good task. I just don't know if there is a command to kill a task.
You would have a couple of options, some I will give a quick outline for.
Firstly, your requirement appears to be one for a shared worklist, have you investigated that as an option? That could remove the routing problem altogether.
Presuming shared worklist is not what you want to do, you would have to include an event handle somewhere in the process to investigate if the other task is complete.
For example, you could have a process level variable that you set to a particular value when any route reaches task4, making the information available to the other task(s) that they too should complete.
Then you would have to follow that by investigating that value in an event, such as a reminder or a deadline, and then process the task item accordingly. (Eg have an hourly reminder that is not sent to user, at the event code investigate the process level field. If it is set to true, set the actionSelected to an action that routes the process to Task4.)
The last thought of otions for now would be to write a automatic prosessing of these items using a scheduled task (either in windows or in the DBMS) that investigates items for each process instance, and uses the API to process items automatically based on the appropriate status. This would obviously be a bit more work and woud require a detailed understanding of the API..