Adding your own pages
Out of the box, notifications can show on role centres and on the customer, vendor, item, sales and purchase pages. A developer can add any other page with a small page extension and an event subscriber in their own extension:
pageextension 50100 "My Page SPN" extends "My Page"{ var SPNNotifier: Codeunit "SPN Page Notifier";
trigger OnOpenPage() begin SPNNotifier.PageOpened(Page::"My Page"); end;
trigger OnAfterGetCurrRecord() begin SPNNotifier.RecordChanged(Rec); end;}
codeunit 50100 "My SPN Pages"{ [EventSubscriber(ObjectType::Codeunit, Codeunit::"SPN Notification Mgt", 'OnCollectSupportedPages', '', false, false)] local procedure AddMyPage(var PageIds: List of [Integer]) begin PageIds.Add(Page::"My Page"); end;}- The subscriber makes the page selectable under Show On Pages.
- Keep
SPNNotifieras a page variable: it remembers the page’s rules and the last record shown. - Your extension needs a dependency on Spotlight Notifications.