- Open your AL project in Visual Studio Code.
- In Explorer, create a new file named Customer Card Notification.al, and in Editor, create a new codeunit object:
codeunit 50108 "Customer Card Notification"{}
- In order to make the notification show, we must subscribe to OnAfterGetRecordEvent so that our notification will be evaluated when the customer record is retrieved from the database.
Add the following code to the codeunit object to create the subscriber:
[EventSubscriber(ObjectType::Page, Page::"Customer Card", 'OnAfterGetRecordEvent', '', false, false)]local procedure OnAfterGetRecordEvent(var Rec: Record Customer)begin HandleCustomerCardNotification(Rec."No.");end;
- Now, let's create the function that shows the notification ...