Team up with our RPA strategy and tech specialists for maximum automation impact

Find out more
Harness the power of UiPath in your business.

Save money and spend more time on priority work.

Book consultation

Let's choose, design and deploy a process automation solution for your business.

Find out more

Let's analyse your business to discover opportunities for innovation and automation.

Find out more

Begin your business transformation journey

Book consultation

Automate where it matters most. Scale to solve challenges in every area

Find out more

Equip people with user-friendly solutions that save time and make work easier

Find out more

Which business problem
can we solve first?

Book consultation
19 June 2015

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 Automated Testing Software

BenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.


Free K2 Five Upgrade Review

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 IT 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…

Need further technical advice or support?