Using Automatic Feedback Message Generation

Objective

A common usability principle is that user must be kept informed of the consequences of their actions on the system. While creating these messages manually is possible, creating and maintaining these messages can take a lot of time.
As these tasks can be automated, K2BEntityServices includes logic to generate these messages automatically while allowing the developer to fully customize their content.

How it works

To implement this feature, K2BTools implements a message queue stored in the user session. This queue stores the messages that must be displayed to the user. When running the Start event of web panels generated with K2BTools, the queue is queried and all the messages stored in it are displayed. In this way, messages can be created that confirm an action even if the action itself causes the user to be redirected to another screen.

Configuration

The generation of these messages can be customized either locally in one particular instance, of globally through the K2BEntityServices settings object.

Global configuration

AutomaticFeedbackGlobalConfiguration
Global configuration properties

Within the settings object of the K2BEntityServices pattern, several properties have been added as shown in the image above. The values of these properties are used to determine the default values of similar properties at the pattern instance level. Their semantics is as follows:

  • Generate After Trn Messages: When set to “True”, the corresponding code will be generated in all transactions to generate the corresponding feedback messages.
  • After <Event> Message: It contains the expression used to create the message within the code added to the transaction. Within this property, the tag “<TrnDescription>” is replaced with the transaction name, and the tag “<DescriptionAttribute>” is replaced with the name of the description attribute of the transaction, if it exists.

Instance configuration

AutomaticFeedbackInstanceConfiguration
Instance configuration properties

Within the Transaction node of the K2BEntityServices pattern instances we can change the messages defined at a global level in the pattern’s settings object using the properties with the same name. The default value of these properties is calculated based on the value specified in the settings object using the algorithm described in the previous section. For the case shown in the image, the tag “<TrnDescription>” was replaced with “customer”, and the tag “<DescriptionAttribute>” with “CustomerName”.

If necessary, the developer can change the value of these properties to change the content of the feedback message.

Message Queue configuration

MessageQueueConfiguration
Message queue configuration

The property “Generate Message Queue Display Code” inside K2BTools General settings determines whether the web panels created with K2BTools will include the necessary code to show the messages included in the message queue used to implement this feature. This property can be used to avoid generating the code in KBs where we don't want to use this feature.