Task Allocation Service
The Task Allocation Service Service Type provides methods used to assign tasks to users based on round-robin algorithms, and to retrieve hierarchical manager/reports information from the user information store, which is most often Active Directory.
Service Authentication
The following Authentication Modes may be used with the Service Type:
- Impersonate
- ServiceAccount
- Single Single-on
- Static
Service Keys (Service Instance Configuration Settings)
Key | Can be modified | Data Type | Sample Value | Notes |
---|---|---|---|---|
Default User | Yes | Text | SECURTYLABEL:DOMAIN\UserName | The DefaultUser is the user name that various methods use should there be an error in the lookup (eg: a non-existent role name, or missing manager in AD). This username prevents the process from entering an error state because no user is found. Typically, this Default User would then manually redirect the work item to the correct person. |
K2Server | Yes | Text | LOCALHOST | The name of the K2 server. |
K2ServerPort | Yes | Text | 5555 | Enter the K2 Server Port. |
RoundRobinSO | Yes | Text | RoundRobinSO | The name of the SmartObject to use for performing RoundRobin calculations. The standard RoundRobin SmartObject is a SmartBox SmartObject which contains the necessary properties to perform the required calculations. You can create your own SmartObject if you wish to adjust he behavior of the round-robin algorithm and specify the name of your SmartObject here. However, the SmartObject must contain the following 3 properties (with these exact names):
|
K2LogConnection | Yes | Text | Data Source=[SQLServerName];Initial Catalog=K2;Integrated Security=SSPI;Persist Security Info=False; | SQL connection string to the K2 database. This property contains sensitive information. You can enter and see your values when you first configure this value. The value will be masked when the service instance is updated. |
Service Objects
The Task Allocation Service Instance creates two Service Objects.
- Task Allocation Active Directory Methods
- Task Allocation Role Methods
(See the tables below for more information on the available Service Object methods)
GetManager | |
---|---|
Description | Returns the Manager (as defined in the user information store, e.g. AD) of the specified user. If no manager is found, the DefaultUser is returned. Typically used to assign tasks to a user's manager. |
Input Parameter(s) | User Login Name (string) |
Return Parameter(s) | Manager Login Name (string) |
Method Type | Read |
Notes | This method is dependent on AD read access permissions. The query is performed in the security context of the K2 service account. |
GetDirectReports | |
Description | Returns a list of all the direct reports for the specified user (in other words, a list of all the users for which the specified user is the manager). If none found, the DefaultUser is returned. |
Input Parameter(s) | User Login Name (string) |
Return Parameter(s) | List of User Login Names (string) |
Method Type | List |
Notes | This method is dependent on AD read access permissions. The query is performed in the security context of the K2 service account. |
GetLeastWork | |
---|---|
Description | Returns the username with the least work items on their work list for the specified role. If the role does not exist or don’t contain any users, the DefaultUser is returned. |
Input Parameter(s) | Role Name (string) |
Return Parameter(s) | User Name (string) |
Method Type | Read |
Notes | This method impersonates the various users in SourceCode.Workflow.Client in order to count the number of work items. In order to do this, the account that the K2 Server is running under needs to have Admin and Impersonate rights on the workflow server. |
GetMostWork | |
Description | Returns the username with the most work items on their work list in the specified role. If the role does not exist or don’t contain any users, the DefaultUser is returned. |
Input Parameter(s) | Role Name (string) |
Return Parameter(s) | User Name (string) |
Method Type | Read |
Notes | This method impersonates the various users in SourceCode.Workflow.Client in order to count the number of work items. In order to do this, the account that the K2 Server is running under needs to have Admin and Impersonate rights on the workflow server. |
GetRoundRobin | |
Description | When using the method GetRoundRobin and using the RoleName as a parameter, it retrieves the next user in the role that should get the work. This method works in conjunction with the RoundRobin SmartObject, which stores users in the SmartBox table and Round Robin-assigns work. Returns the next user name in a specified role in a round robin fashion. If the role don’t exist or don’t contain any users, the DefaultUser is returned. |
Input Parameter(s) | Role Name (string) |
Return Parameter(s) | User Name (string) |
Method Type | Read |
Notes | This method stores the last user name to which work was allocated. If the method is called again, this user name is retrieved and work is allocated to the next user in the role. This is implemented by use of a SmartObject . The name of the SmartObject to be used is specified in the RoundRobinSO service instance key. |
GetFastestUser | |
Description | Returns the username with the lowest Average Work Completion Time (regardless of work item type) that falls within the range specified by Min Time (in seconds) and Max Time (in seconds). If no user falls within this range, the DefaultUser is returned. Note: It is recommended that MinTime > 0, in this way you exclude users that have not yet completed any work items (and hence have an average of 0) |
Input Parameter(s) |
|
Return Parameter(s) | User Name (string) |
Method Type | Read |
Notes | This method calculates the average work completion time, by making a direct connection to the K2ServerLog database and executing a SQL statement that averages all user work completion time. |
GetSlowestUser | |
Description | Returns the username with the highest Average Work Completion Time (regardless of work item type) that falls within the range specified by Min Time (in seconds) and Max Time (in seconds). If no user falls within this range, the DefaultUser is returned. Note: It is recommended that MinTime > 0, in this way you exclude users that have not yet completed any work items (and hence have an average of 0) |
Input Parameter(s) |
|
Return Parameter(s) | User Name (string) |
Method Type | Read |
Notes | This method calculates the average work completion time, by making a direct connection to the K2ServerLog database and executing a SQL statement that averages all user work completion time. |
GetRolePeers | |
Description | Returns the specified user's peers in a Role. This looks up all the users within a specified Role, and returns all users except the user specified. If the role don’t exist or don’t contain any users, the DefaultUser is returned. |
Input Parameter(s) |
|
Return Parameter(s) | List of User Names (string) |
Method Type | List |
Notes | This method looks up the members of the specified role |
SmartObjects
K2 automatically generates SmartObjects for these Service Objects. SmartObjects can be automatically created by selecting the Generate SmartObjects for this Service Instance check box when creating a new Service Instance. Designers can use the SmartObject design tools to build advanced SmartObjects that leverage the Service Objects in this service. It is recommended to use the SmartObject design tools to create SmartObjects rather than generating SmartObjects, since this allows better control over the naming, behavior and design of the SmartObject and its methods and properties.