26 Feb’19

D365 Business Central

Adding 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

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

  • How to enable Document ID in SharePoint Online

    16 May’ 2019

    Introduction: As you know that SharePoint Online can be used as a document management platform and with the help of Docu...

    Read more
  • Count Number of files in SharePoint folder

    15 May’ 2019

    Introduction: This blog explains how to Count No of files in SharePoint folder using MS Flow. Steps to be followed:Sel...

    Read more
  • Professional Services Automation (PSA) for CPA firms

    14 May’ 2019

    With the evolution of Technology, every industry is getting process oriented and so are CPA firms getting more organized...

    Read more
  • What if the Resource Requirement Still appears post the task is deleted from Schedule (WBS) in PSA V3?

    13 May’ 2019

    Problem Definition: I have observed a fact in PSA that when the task in PSA Schedule (WBS) is deleted, the corresponding...

    Read more
  • Discount Settings for D365 Sales Line Items – Line Items or Per Unit?

    10 May’ 2019

    For Line Item entities Opportunity Products, Quotes Products, Order Products or Invoice Products, you can chose what typ...

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