I have been writing blogs on the amazing new feature of 2019 Wave 2 release , so this is additional to previous blogs.
Notifications provide a programmatic way to send non-intrusive information to the User Interface (UI) in the Web client.
You can use Notification and NotificationScope data types and methods in AL, Code can be added notify users. The following table provides an overview of the available methods.
|MESSAGE||Specifies the content of the notification that appears in the UI.|
|SCOPE||Specifies the scope in which the notification appears.|
|SEND||Sends the notification to be displayed by the client.|
|ADDACTION||Adds an action on the notification.|
|SETDATA||Sets a data property value for the notification|
|GETDATA||Gets a data property value from the notification.|
|RECALL||Recalls a sent notification.|
So this is basics about Notification in Microsoft Dynamics Business Central Wave 2 Release.
Now lets have a look at the Code aspect in AL.
How to Create Notification in AL
In this example we will Create Message,Scope, Send, AddAction,SetData.
So lets start Creating the Extension.
Open VS Code and Press “Ctrl + Shift + P” to open Command Pallet.
Give Project Name as CreditBalanceNotification and Setup App.json file.Refer to My Blog on How to Connect Dynamics 365 Business Central 2019 Release Wave 2 to Visual Studio Code
Create a New file CreditBalanceNotification.al and Create Page Extension as shown below.
As shown in the above Screen shot CreditBalanceNotification is of having Data Type as Notification.
So from this variable we can access all the method which are stated in above table.
As specified in the ADDACTION we have used ActionHandler Codeunit, and below is the code for the same.
This is simple code where if we get he Customer then it will open the Customer Page.
You can download the code from GitHub.
Now we will test this, if you go to sales order page and check a Sales Order for the Customer whose Balace is greater then Credit Limit then you will get this notification.
You can change the credit Limit by clicking on the link.
To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn
Thanks for Reading.