Task Delegation

K2 provides delegation features out of the box. Every manager in the directory has access to their subordinates’ tasks. As a user you can redirect your worklist items to anyone in the directory as well.

there is also a nice out of office component that allows users to setup out of office scenarios as well.

When you want a group of users to have exclusive access to business process tasks so that they can manage them, you either make this group of users as a destination in those tasks of interest and leverage the K2’s out of the box task management features OR will need to use K2 APIs to implement this functionality.

K2MNG is the management API that can be used by anyone who has K2 Admin permissions. this API allows you to implement custom interfaces that can provide functionality (or a sub set) that is found in the K2 service manager tool.

let’s look at the code required to set this up.

1. you connect to K2 via the management API as a k2 admin (only K2 admins can use this API) -> K2Manager.login(…)

2. you get the worklist items for process instances you are interested in. This will bring in any currently running processes’
worklistitems from the criteria you have passed in. look at the help for detailed info on this method and other parameters. there is also a sample in the K2 help file. -> K2Manager.Getworklistitems(…)

3. you then redirect any interested worklistitems to anyone required.

5. you disconnect -> K2Manager.logout()

Try

Dim kmgr As New SourceCode.K2Mng.K2Manager

‘I must be a K2 Admin

kmgr.Login(“localhost”, 5252)

Dim wl As SourceCode.K2Mng.WorkListItems = kmgr.GetWorkListItems( Nothing,
“project\processname”)

‘redirect this wlitem to admin

‘you need to find and select which one/ones you want to redirect

kmgr.RedirectWorklistItem(wl.Item(0).ID, “Administrator”)

kmgr.Logout() ‘remember to logout

Catch excep As Exception ‘catch any exception

‘ Exception Occurred 🙂

End Try

Leave a Reply

Discover more from jeylabs

Subscribe now to keep reading and get access to the full archive.

Continue reading