Documentation Center

Notification framework

The SDL Tridion Sites GUI core contains a notification implementation that can send out notifications for events occurring in the Content Manager. By default, this notification framework only sends notifications for save events (triggered by the creation or modifications of items), but you can add Event Handlers to send out notifications for other types of events too. You can add code to your GUI extension to catch these notifications and act on them.

The notification framework offers a notification implementation with the following benefits:
  • The client does not need to poll the server for information.
  • The server is less likely to experience a heavy load.

Do note, however, that the framework sends notifications to all clients, so do not send sensitive information out with a notification.

To send out notifications for specific events occurring in the Content Manager (other than saving, which results in notifications already by default), create an Event Handler that detects such an event occurring and sends out a notification for it. (You can, of course, also implement notifications for events occurring in your own systems.) The framework sends out these notifications to all Content Manager clients.

If your GUI extension communicates with Content Manager, use the Notification Broadcaster (as found in the file %TRIDION_HOME%\web\WebUI\Core\Client\NotificationBroadcaster\NotificationBroadCaster.js) to catch these notifications. To optimize performance, the Notification Broadcaster relays messages with a 5-second delay, discarding the message if a new message referring to the same item is received during those 5 seconds.

Specifically, to get an instance of the NotificationBroadcaster object and register a handler for its "notification" event, add the following to your implementation:
var notificationBroadcaster = Tridion.Web.UI.Core.NotificationBroadcaster.getInstance();
notificationBroadcaster.addEventListener("notification", notificationHandler);
When the NotificationBroadcaster instance dispatches an event, the event object has a data property that has the following format:
{subjectId: SUBJECTIDSTR, action: ACTIONSTR, details: DETAILSSTR}
in which:
  • SUBJECTIDSTR identifies the item that an action was being performed on, enclosed in quotes. For example, this could be "tcm:6-15-4096", the URI of a content item.
  • ACTIONSTR specifies the action that has been performed, , enclosed in quotes; for example, "tcm:updated" to indicate that an existing item was updated.
  • DETAILSSTR any additional custom information, or null if no such information is returned.

You can now process the message you received and act on it. For example, you could display a message to the GUI end user, update the items in a list you display, or otherwise change the GUI in response to the notification.