Custom error messages in K2 SmartForms

Most of you out there that 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:

pstrindl_StandardError

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!

 

  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:
    pstrindl_FormErrorRule
  2. Then we configure this rule with a set of actions and conditions:
    pstrindl_ErrorActions

    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:
    pstrindl_AdvancedCondition
    (click to enlarge)

    After that, we can be creative and do what ever 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.
    pstrindl_CustomMessage

 

Read more about error handling in K2 SmartForms: http://help.k2.com/onlinehelp/k2smartforms/userguide/1.0.7/default.htm#SF_-_Rule_Designer_-_Events.html

One Response

  1. Nick Patterson December 22, 2015

Leave a Reply