Introduction

When a user opens a worklist item on his worklist, the item will be, by default, allocated to the user, restricting access to other users attempting to open the same worklist item. The developer can control whether the item should be allocated to the user or not.

Steps

K2.net™ 2003 SmartForms makes use of K2ROM.dll to retrieve worklist items from K2.net™ 2003 Server. The OpenWorklistItem() method used by SmartForms to open worklist items contains the following parameters:

[Visual Basic]

Overloads Public Function OpenWorklistItem( _
  ByVal SerialNumber As String, _
  ByVal Platform As String, _
  ByVal Alloc As Boolean, _
  ByVal IgnoreStatus As Boolean _
) As WorklistItem
 
[C#]
public WorklistItem OpenWorklistItem(
  string SerialNumber,
  string Platform,
  bool Alloc,
  bool IgnoreStatus
)

 
SerialNumber:
The SerialNumber gets generated by K2.net™ 2003 Server during execution of a Process Instance. The SerialNumber is a combination of [<K2Server>,<ProcessInstanceID>,<EventInstanceID>], making each SerialNumber unique on the K2.net™ 2003 Server.

Platform:
Represents the platform that is used to deliver the WorkItem to the workflow participant.

Alloc:
Making the Alloc parameter True will force K2.net™ 2003 Server to Allocate the WorklistItem to the user specified in the Connection.Open() method (Default is True). Once the worklist item is allocated, K2.net™ 2003 Server will restrict access to the worklist item to only the user it is allocated to or the Manager of the allocated user.

IgnoreStatus:
The IgnoreStatus parameter allows you to open a worklist item and ignoring the allocated status. If IgnoreStatus is set to False and the worklist item has been allocated to another destination user K2.net™ 2003 Server will restrict access to this worklist item.

Configuring a Default client event in K2.net™ 2003 Studio

The default web page URL setting on the client event will include the following required query string: "?sn={SERIALNO}". The generated code for the client event will replace the {SERIALNO} with the actual serial number of the event which will later be used as the URL to load the client page.

 
 
Code Sample:
Function HTTPFunction(ByVal K2 As ClientEventContext)
  Dim strURL as String
  strURL = "http://Site/TestWeb/mypage.aspx?sn={SERIALNO}"
  strURL = strURL.Replace("{SERIALNO}",K2.SerialNumber)
  K2.AddWorklist("ASP",System.Web.HttpUtility.UrlPathEncode(strURL))
End Function
 
The initial status of the worklist item is set to "Available" before the user opens it.
 
 
Once the user clicks on the worklist item, the item will be opened and loaded. Note that the status now appears as "Open" (worklist item allocated to user). K2.net™ 2003 Server will restrict access to other users attempting to open the same item.
 
 
To make the worklist item available to other participants while you have it open, include the following query string as part of the web page URL on the client event.
 
 
Code Sample:
Function HTTPFunction(Byval K2 as ClientEventContext)
  Dim strURL as String
  strURL = "http://Site/TestWeb/mypage.aspx?Allocate=false&sn={SERIALNO}"
  strURL = strURL.Replace("{SERIALNO}", K2.SerialNumber)
  K2.AddWorklist("ASP",System.Web.HttpUtility.UrlPathEncode(strURL))
End Function
 
The initial status of the worklist item is set to "Available" before the user opens it.
 
 
Once the user clicks on the worklist item, the item will be opened and loaded. Note that the status now remains "Available" to other participants (Worklist item NOT allocated to User).