26 Feb’19

D365 Business CentralAdding Notifications in Microsoft Dynamics 365 Business Central

Introduction:

Notifications provide a programmatic way to send non-intrusive information to the user interface (UI) in the Microsoft Dynamics 365 Business Central. Their purpose is to provide users with some information about a current situation without any necessity to perform or block an action.

Pre-requisites:

1. Microsoft Dynamics 365 Business Central

Steps:

1. Create a global variable of the type notification:
LoadsNotification: Notification;

2. The different functions used in notification are as follows:

Message: It includes the message to be shown in the notification

Scope: Specifies the scope where the notification appears.

AddAction: To add an action to notification

SetData: To set the data property value in a notification

GetData: To get the data property value in a notification

Recall: To recall a sent notification

Send: To send the notification to the user.

3. In this case I have used the notification function to be displayed if the ColorVar is unfavorable i.e. red and the day is Thursday, Friday, Saturday or Sunday. If the above condition is satisfied then the notification is displayed with an action to schedule Loads otherwise no notification is displayed. The code is as follows:

if ((ColorVar = 'Unfavorable') and (UnscheduledLoadsCount > 0)) then begin
LoadsNotification.Message('There are ' + Format(UnscheduledLoadsCount) + ' loads yet to be scheduled.');
LoadsNotification.Scope(NotificationScope::LocalScope);
LoadsNotification.AddAction('Schedule Loads', Codeunit::EventHandlingCU, 'OpenUnscheduledLoadsByVendor');
LoadsNotification.send;
end;

The Procedure OpenUnscheduledLoadsByVendor is created in the codeunit EventHandlingCU to open the page when action is triggered.

procedure OpenUnscheduledLoadsByVendor(LoadsNotification: Notification): Text
begin
Page.Run(50139);
end;

Conclusion:

Thus, this way notifications can be created in Business Central to notify the users some important information without blocking actions of the users.

Written by

Dhruv Mehta

Trainee Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Expenses in PSA for Fixed Bid and T&M contracts

    23 August’ 2019

    Problem Definition: One of my clients decided to use Expense module in PSA and to his surprise he could see the amount v...

    Read more
  • Setup Dockers

    23 August’ 2019

    Docker is an independent container platform that enables organizations to seamlessly build, share and run any applicatio...

    Read more
  • Qualify Lead in D365 CE: Select which entity records should be created

    20 August’ 2019

    Wave 2019 Updates brought some really sought-after features. Another one which I would like to bring up is the Lead Qual...

    Read more
  • Early Opt-in for October 2019 Wave 2 Updates

    20 August’ 2019

    August 2, 2019 was when the Wave 2 Updates were to be out. And here we are! By now, you should have gotten the option to...

    Read more
  • Setting Unified Interface App Icons

    20 August’ 2019

    Default App Icons for typical D365 environment look like these.But here’s what you can do to change these to put...

    Read more
  • We respect your privacy.
  • This field is for validation purposes and should be left unchanged.