There are many scenarios in which our end users need to be notified when certain events occur in the application. These events can be, for example: “the invoices are about to expire”, “the price of product X has changed”, “an order is pending your authorization”, “the order was authorized”, etc.
These events can be notified by several delivery media, for example: Web Notifications, E-Mail, and even Push Notifications, Messaging apps, etc.
K2BTools provides a “Notifications and Collaboration” module, that handles the creation and delivery of notifications via Web Notifications, and E-Mail. An APIs that can be used to trigger events is provided in the module. Also, the module allows end users to subscribe to the event types that they find relevant and to select which delivery media should be used in each case.
To use the Notification and Collaboration module some basic concepts must be understood.
Is something that happened in the application that should be notified. An example of an Event is “The invoice X is about to expire”, “The price of the product Y was changed”, “The order Z was authorized”. As the Event depends on the application logic, an API to create events is provided with the module.
Every event is of a certain Event Type, that can be used to classify them. Each Event Type is associated with an entity in the application.
Examples:
- For the “The Invoice X is about to expire” event, the Entity is “Invoice” and the type name could be “AboutToExpire”.
- For the “The price of the Product Y was changed” event, the Entity is “Product” and the type name is PriceChanged.
The configuration of an event type determines who gets notified of each event and how.
For more information read Creating an Event Type.
An event also has an Instance reference. An instance reference refers to the entity instance in which the event occurs.
Examples:
- For the “The Invoice X is about to expire” event, the instance reference is a reference to the invoice X (its primary key).
The event also has a life cycle, that determines if the event is still valid or not. For more information read Event expiration and cancelation.
When an Event occurs it should be notified to relevant users, using appropriate delivery media, giving a user friendly message. We will describe these concepts in this section.
Notifications are sent to the end user through different delivery media. Examples of delivery media are: E-Mail, Web Notification, Messaging apps, Push Notifications, etc.
K2BTools provides implementations for WebNotification and E-Mail, and allows the user to add support for other delivery media.
For more information read Configuring a Delivery media.
When an event occurs, how does the notification module know who should be notified, and by which delivery media? This section summarizes how these questions are answered.
The list of users that is notified is created from two sources: the event type configuration, and the event declaration.
When declaring the event, the developer can include a list of users that should be notified about the event. These users should be the users involved in the event in some way. For example, if user A created a request and another user approved it, triggering a “request authorized” event, the event could include user A as a recipient for the event, as this user is probably waiting for that approval.
For more information read Creating an Event.
In some cases, certain users wish to be notified of all events of a certain type. This can happen when, for example, a user wishes to keep tabs on bank accounts to check that they are not overdrafted. Supposing there was a “Balance low” event on the “Bank account” entity, the user may wish to subscribe to events of that type to be notified about all events. This can be configured in the event type.
For more information read Creating an Event Type.
Also, sometimes the user wishes to keep track of certain entities in the system. For example, let’s suppose that a certain work order is of vital importance to user B. In that case, B may subscribe to that particular work order, to get notifications about all events related to that work order.
For more information read Suscribing to an instance of an entity.
K2BTools currently supports two delivery media (Web notifications and email), but the module can be extended to support other media.
Which delivery media should be used to notify a user that a certain event happened? The answer lies in two places: The event type configuration, and the users personal preferences.
In the event type configuration the list of supported delivery media is configured. Only the delivery media in this list can be used to notify the user about events of this type.
Users can configure which of these delivery media should be used when sending notifications to each of them using their personal preference. The users can only choose from the list available for the event type, and may choose to enable or disable the notification using that media.
The event type configuration may determine if the delivery media is enabled by default or not.
For more information read User configuration of system events.
End users may use this module to interact among themselves while navigating the application, by adding comments to entities.
This module uses GX features with special requirements.
To use the Notification and Collaboration module, the module must be installed in the KB.
For this purpose read Installing the notifications and Collaboration module.
An event can be created using the NewEvent procedure provided by the Notifications and Collaboration module. Before using the NewEvent method the Event Type must be defined in the module’s configuration.
For more information read Creating an Event.
In order for the Web Notifications to be shown, a notification panel must be included in the Master Page.
For more information read Enabling Web Notifications in the application.
|