This article explains how to add custom error handling in a K2.net 2003 Smartforms project. This can be illustrated by capturing the “All Worklist items have been allocated” exception.

This error occurs when user ‘B’ selects a Worklist item, (which is still displayed as ‘Available’ in Workspace), after the item has already been allocated to user ‘A’.
 

Cause: User ‘B’s Worklist has not yet been refreshed.

 

Resolution:
Automatically refresh the Workspace of user ‘B’ whenever the error occurs, by doing the following:
1. Catch the error on the K2.net 2003 ASP.NET Smartform:


 

1.1  Select your client page’s properties

1.2  Select the event properties for the page

1.3  Specify an “Error” event
2. The “Error” event will catch all errors that are raised when the page loads.
3. Now you can receive each specific error message and specify a way to handle it
 
  
 
4. If the error message equals “All Worklist items have been allocated”, redirect to a new HTML (“Refresh.htm”) page you added to the project.
5. On this “Refresh.htm” page, add a function to refresh the user’s Workspace.