+44(0)1908 545 770
YOUR EXPERT RPA PARTNER

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

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

Save money and spend more time on priority work.

Book consultation
READY, SET, AUTOMATE

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

Find out more
TRANSFORM YOUR BUSINESS

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

Find out more

Begin your business transformation journey

Book consultation
AUTOMATE EVERY FUNCTION

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

Find out more
GIVE EVERY TEAM THE TOOLS FOR SUCCESS

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
06 February 2018

Display User Friendly Error Messages in K2 SmartForms

When developing K2 SmartForms, most developers tend not to implement user friendly messages. In this blog, we will go through step-by-step how to implement error handling that results in a  user-friendly K2 error message being displayed to the users when an error is raised.  The method for doing this in K2 SmartForms is similar to how we do it for conventional .NET applications.

 

 

Free K2 Five Upgrade Review

Let’s see how to implement this.

The screenshot below shows an example implementation with each of the steps to follow to implement error handling in K2 SmartForms that displays user-friendly messages upon the “If an error occurred” SmartForm condition:

Step 01

First, use the “If an error occurred” condition to catch the error and then transfer the error message to the form/view parameter.

Step 02

We must use the action “continue to next execution” otherwise the rule will stop executing after transferring the error message to the parameter.

Step 03

Now we have an error message. Based on the message, we need to add multiple “if-else” conditions to show the custom error message.

For example, if there is an unique key violation, then the default error message will be as below:

Violation of UNIQUE KEY constraint ‘IX_employeename’. Cannot insert duplicate key in object ‘dbo.Employees’. The duplicate key value is (John).The statement has been terminated.

To define a user-friendly error message for this error, check if the error message parameter contains “Violation of UNIQUE KEY constraint” and a rule to “Show a message to the user”.  An example is shown below:

Step 04

If none of the conditions match, simply display the original message to the user.

Step 05

Finally, remember to clear the error message parameter.

Need further technical advice or support?