The simplest way to add a notification is to use the notificationSend function.
Active from
— the date-time from which the notification will be considered active.
Title
— internal technical title, not displayed to the user.
User
— id
of the user for whom the notification is intended.
Code
— a string in the notification codes table defining the type of notification.
Parameters
— parameters passed for a specific notification.
Active
— indicator of the notification's activity.
Priority
— the priority of displaying the notification if the user has several. If the priority is the same, the notifications will be displayed in ascending order of their id
.
Notification priority
1
>
10
. The smaller the number, the higher the priority.
Defines the type of notification.
Name — internal name of the notification type.
Code Name — unique name of the notification type, by which it will be called.
Code — the action code of the notification. The result of the functions should be returned from the =:
section:
linkTodataText — simple text.
linkTodataHtml — text formatted in html
.
linkTodataTable — call a temporary table with parameters $#params
defined in the parameters
field of the notifications table.
To add a notification, you need to add a row to the notifications table:
=: insert(table: 'notifications'; field: 'code' = "tmp_text"; field: 'active_dt_from' = $#ndt; field: 'title' = "Notification title to be shown in the latest notifications table"; field: 'user_id' = 1; field: 'vars' = $vars; field: 'active' = true)
vars: rowCreate(field: "title" = "Notification title"; field: "text" = "Notification text")
Code tmp_text
in notification codes:
=: linkTodataText(title: $#title; text: $#text)
To add a notification as a table, in notification codes it should be called through linkTodataTable:
=: linkToDataTable(table: 'tmp_table'; title: "Notification title"; height: 400; params: $row; data: $data)
row: rowCreate(field: "h_test" = $#val)
data: rowListCreate(field: "goods" = $#goods; field: 'count' = $#count)
The parameter is set in
System Tables
—Main
—Settings and Cron
—Settings
—Notification Check Frequency
.Specified in seconds. If the parameter is empty, notifications are not checked.