In this excerise, we are going to create an event that will notify users that are subscribed to a invoice when it is paid.
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:
- Open the "K2BMainMenu" pattern instance
- Add a new "SubMenu" with code "Notifications"
- Add an "IncludedMenu" node.
- Set the "Instance" property in that node to the name to Notifications Module Menu.
|Notifications Menu included in main menu
- 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.
- Access to "Event Types" web panel located inside the Notifications menu.
- 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
- Confirm the new event.
Once the event is created, it is possible to customize notifications related to this event.
In order to do so, follow these steps:
- Access "Event type" web panel located in the notifications menu.
- Click on "PaymentReceived" event.
- Click on "ADD NEW" delivery media and insert a new delivery media with "Media Code": Web Notification."Enabled by default": True
|New Delivery Media
- 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.