FogBugz Plugin API > Showing Notifications
The CNotificationsApi class allows plugin developers to create error, message, and admin notifications in any block of server-side plugin code. CPluginApi.Notifications an always-accessible instance of the CNotificationApi class.
Error Notifications
This example notification was generated using the AddError() method:
api.Notifications.AddError("Sample Error Notification");
Message Notifications
Message notifications communicate an informational message to any FogBugz user viewing the page where the notification is generated. These are not persistent across multiple page loads:
This example notification was generated using the AddMessage() method:
api.Notifications.AddMessage("Sample Message Notification");
Admin Notifications
Admin notifications communicate an important system error to all FogBugz admins. When an admin notification exists, the following message is displayed at the top of admins' FogBugz screen. As with FogBugz-generated admin messages, these persist until dismissed by an admin clicking the "Hide Notification" link:
Upon clicking the "Some errors" link, the admin is taken to the "Notifications" page, where the Admin error appears:
This example notification was generated using the AddAdminNotification() method:
api.Notifications.AddAdminNotification("Admin Notification", "Here's a sample admin notification.");
Plugins can also remove the Admin notifications they create specified by description. For example the above message could be removed by the plugin with the following code:
api.Notifications.RemoveAdminNotification("Admin Notification");