Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Notification API

Notification API: addNotification

Scroll Prev Next More

 

Adds notification for one or all users.

SyntaxArguments

message

notification text

title

optional notification title

icon

optional icon, can be in one of three formats:

- URL: "https://website.com/path/image.png" or "images/file.gif"

- Bootstrap icon: "glyphicon-film", "glyphicon-hand-right"

The full list of available Bootstrap icons.

- Font Awesome icon: "fa-envelope", "fa-user"

The full list of available Font Awesome icons.

url

optional URL. When specified, a click on notification sends the user to the specified address. See makePageLink function

expire

optional expiration date and time for the message. Can be either datetime in "YYYY-MM-DD hh:mm:ss" format, or a number of minutes the notification should be visible. After the expiration date/time the notification will be deleted from the notifications table.

Examples:

"2022-01-10 00:00:00" or 1440 for 24-hour period

user

username the message should be visible to. If not specified, all users and guests will see the notification.

provider

when user is a database user, whose username and password are stored in a database table, this parameter must be empty. When the user is from Active Directory, OpenID, Google etc, then put the two-letter security provider code here. You can find it on the 'Security screen' under the provider settings dialog.

Return value

No return value

Example

This example shows how to add a notification for all users when a new record added to the Categories table. This code needs to be added to AfterAdd event of the Categories table.

See also:

About Notification API

Function createNotification

Function makePageLink