How do I interact with a workflow process instance once it is running? K2 provides an API which allows programmatic access to workflow instances that are in motion.
If you have a task assigned to you as part of a workflow process, you will have a task sitting in your worklist. In K2 you dont physically have a task in your worklist. There is a task in the system and you have access to it. K2 handles concurrent access. The default mechanism is first come first serve. The concept of slots is used to handle complex routing scenarios with ease.
using(Connection con = new connection())
WorklistItem wli = con.OpenWorklistItem(“serial no”);
// WorklistItem.Actions.Execute() will perform the selected action on the task and complete it!
A WorklistCriteria can be sent to the OpenWorklist() method on the Connection object
allowing filters on a huge Worklist to help it perform better.
ClientEvents correspond to Human Tasks and a Worklist item. The Task has to be completed to end this ClientEvent in the workflow process and allow it to proceed to the next event.
You can also re-assign tasks, push tasks back in to work Queues and move the process execution from one state to another. All this functionality is supported through the APIs.