K2 Workflow Event Wizards: Configure an Exception Rule

K2 WorkFlow Exception Eule

It is sometimes easy to get lost among the myriad of functions available in the K2 Workflow. If at any stage anything is missed it can often lead to some unexpected results or even cause down right errors in the system. By default these errors are kept behind the scenes, visible only when delving deep into the K2 back-end. Thankfully K2 provides us with ways to capture and control these errors in the form of exception rules. Today I’ll show you how to enable the exception rules on a K2 Workflow Activity.

First we’ll need a Workflow Activity. A Workflow Activity is a container for K2 Workflow components. Drag-and-Drop an event from the toolbox onto the K2 Workflow Designer, the event will automatically be placed inside a Workflow Activity.

k2 workflow exception rule

Figure 1 – Default Workflow Activity

Now hover your mouse over the newly created Workflow Activity, and run the default wizard by clicking on the down arrow that appears on the right hand side.

Figure 2 - Opening the Default Wizard

Figure 2 – Opening the Default Wizard

The “Activity General Properties” dialog will appear and display the default tab “General Properties”.

Figure 3 - Activity General Properties

Figure 3 – Activity General Properties

On the left side of the dialog, you’ll notice seven icons, each representing a separate Tab. Click on the seventh tab to view the “Exception Rule” screen.

Figure 4 - Exception Rule

Figure 4 – Exception Rule

Once this view is open, enabling the exception rule is as simple as checking the “Enable exception rule” checkbox.

Figure 5 - Enabled exception rule

Figure 5 – Enabled exception rule

Notice that when the “Enable exception rule” option is selected, the rest of the controls are enabled. The checkboxes below provide a simple way for either K2 or the OS to deal with errors. Enabling the “Log exception to the server” checkbox will mean K2 will catch and maintain a list of all exceptions that can then be found within the K2 backend. Enabling the “Log exception to the error log” checkbox will mean the errors will be available within for example the Windows Event Viewer.

In order to provide us with even greater control over these exceptions, K2 allows us to delve right into the code and add exceptions the way we see fit. Click on the “View Code” option to view the Workflow activity in “XOML” format.

Figure 6 - XOML view

Figure 6 – XOML view

Right click on the “Properties” box, and click on the “View Code” option.

Figure 7 - Clicking View Code

Figure 7 – Clicking View Code

Clicking on the “View Code” option will expose the code behind files for the Workflow Activity.

Figure 8 - Code behind

Figure 8 – Code behind

From here simple .NET error handling techniques can be implemented to handle any exceptions. It provides us with the most control over the catching and controlling of exceptions. Please note however that only experienced .NET developers should attempt to perform error handling in this manner.

About K2 blackpearl

The K2 BPM tool and K2 Workflow tool is a enterprise software suite that allows business and technical stakeholders to configure and run workflow-driven business apps that makes people more productive.

K2 is an excellent platform for rapid development, but experience is essential for large scale BPM programmes.  Velocity is a K2 partner with a combined experience or 30 years.  We stand out from the crowd due to our exceptional K2 knowleade that goes back to company formation in 2000.  Please visit our website for more information…

K2 WorkFlow Exception Eule

You may also like

Leave a comment

PODCAST  |  Why you need to establish a K2 Center of Excellence today

Interview with Arno van Rooyen, CEO, Velocity