K2BTools Tutorial - Exercise 16.4 - Creating a new event type

In this excerise, we are going to create an event that will notify users that are subscribed to a invoice when it is paid.

Notificactions Menu

First of all, the application's menu should be updated to include the notifications and collaborations module backend's menu. To accomplish this, you have to:

  1. Open the "K2BMainMenu" pattern instance
  2. Add a new "SubMenu" with code "Notifications"
  3. Add an "IncludedMenu" node.
  4. Set the "Instance" property in that node to the name to Notifications Module Menu.
    LessonNotificationsMenu1
    Notifications Menu included in main menu

  5. Build your application.

Creating the event type

Note: For this part you will have to download the following image (Calendar.png).

Now that the Notifications menu was added, it is time to access the backend and add the event.

  1. Access to "Event Types" web panel located inside the Notifications menu.
    LessonEventTypes
    Event Types

  2. Click on "ADD NEW" in order to insert the following event:
    • Entity name: Invoice
    • Type name: PaymentReceived
    • Type distribution: Public Subscribers
    • Events Policy: Only one
    • Small Icon, Medium Icon, Large Icon: Calendar.png
      NewEvent
      New Event

  3. Confirm the new event.

Customizing Notifications

Once the event is created, it is possible to customize notifications related to this event.

In order to do so, follow these steps:

  1. Access "Event type" web panel located in the notifications menu.
  2. Click on "PaymentReceived" event.
    PaymentReceived2
    PaymentReceived event

  3. Click on "ADD NEW" delivery media and insert a new delivery media with "Media Code": Web Notification."Enabled by default": True
    DeliveryMedia1
    New Delivery Media

  4. Click on "ADD NEW" message templates and add the following templates:
    • Template code: "Web Action Caption". Template text: "View Invoice".
    • Template code: "Web Notif Text". Template text: "The Invoice %InvoiceCode% of customer %CustomerName% has been paid.