Dynamics 365 Dynamics NAV 2017 Uncategorized

Smart Notifications -How To

For Dynamics Nav 2017 / Dynamics 365 for Financials

Smart notifications provide a way to interact and inform the end user without stopping them from doing their work. It’s a Non-Intrusive way to Push messages in Nav unlike MESSAGE() and ERROR().

It’s meant for low importance messages that user should know but not critical enough to stop his work

Scenario: User is filling his expense claim and has not uploaded a receipt for the line he is making. We will use these new types of notification to remind him to upload an invoice receipt also providing them a quick way to do it without leaving the page they are currently using by adding an Action to the Notification.

Steps:

  1. Open a code unit in Dev environment. It could be an existing one depending upon the requirement.
  2. Create a new function and Write logic as required

Syntax for the notification is

 
RecieptNoti.MESSAGE(NoReciept);

RecieptNoti.SCOPE := NOTIFICATIONSCOPE::LocalScope;

RecieptNoti.SEND;

Where RecieptNoti is a Variable of type ‘Notification’

NoReciept is a text constant that holds the value we want to print from message

.Send Sends the notification

NotificationSCOPE has two types Local and Global

Local: It Shows the notification on page from where it was fired

Global: Shows the notification everywhere in Nav no matter where user is.

Note: GlobalScope is not working at this point

Next call this function we just created. Here I am going to call it from OnValidate of Vendor Invoice No. field.

  • Test it

 

 

 

 

 

 

Next we Add an Action to this Notification.

Syntax:

RecieptNoti.MESSAGE(NoReciept);

RecieptNoti.SCOPE := NOTIFICATIONSCOPE::LocalScope;

RecieptNoti.SETDATA('Expense No.',FORMAT(ExpenseLine."Expense No."));

RecieptNoti.ADDACTION(Attach,CODEUNIT::"Expense Attachment Management",'Upload');

RecieptNoti.SEND;

 

.SETDATA lets you set a text into the notification which you can retrieve in the function you call

.ADDACTION(Text, Code unit id, Function Name)

.GETDATA lets you get the data that you previously set in the function and use it for your logic

  1. The Function that we want to add to the notification should have a variable of type ‘Notification and has to be Global for it to work.
  2. Test it.

 

 

 

 

 

 

Clicking on ‘Attach Now ‘ opens a file browse dialog box and lets the user to upload a invoice.

 

Leave a Reply

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