Custom error messages in K2 SmartForms | Quisitive
Custom error messages in K2 SmartForms
May 18, 2015
Learn how to create custom error messages in K2 SmartForms.

Most of you out there who have been building K2 SmartForms for a while have all heard this from the customer “Wow, that error message is really not intuitive!” And usually, they are talking about this error message that comes up when a user is trying to open a task that already has been opened by another user:

So how do we improve this (not so good) user experience for the customer, to make sure they understand what’s going on?

Luckily this is really easy, at least with SmartForms 4.6.9 that I have used in this example. The solution is to build in a bit of magic to the form that will ‘take over’ the default error messages. Let’s go!

How to create custom error messages in K2 SmartForms

1. Create a new rule on the base state of the form (to make sure it spans all the different form states).

Select the event “When the Form raises an event” and select the “Error” event. This will give you something like this:

2. Then we configure this rule with a set of actions and conditions:

The first one is to use the advanced condition to detect what exact error ID to trigger on. In this case the error ID is ‘24411’ and we can pick up that value from the Error Message parameter:

After that, we can be creative and do whatever works best for each case. I this example I’m showing the customized error message to the user and then closing the browser window.

3. The end result will look like this.

I added the error ID in the subject line and the full message to be able to troubleshoot easier.

Read more about error handling in K2 SmartForms: