Part 2: The Non-Intrusive Notifications by Business Central

Part 2: The Non-Intrusive Notifications by Business Central

So, in the previous article - Part 1: The Non-Intrusive Notifications by Business Central, we looked at how to create custom notifications in Business Central...some pretty cool and simple stuff.

In this article, we are going to take it a step further by embedding actions within the notifications.


Case Study

We will be building on our initial case study i.e. The inventory manager wants to be notified about the number of items with zero inventory each time they open the Item List page. This ensures they can quickly identify and address stockout situations. Now, we have developed and implemented this requirement and the client is happy.... so we thought!

New request from the client:

"We want business central to allow us to generate a report based on the items with zero inventory. It would be fantastic if we can click a single button once the notification pops-up and the report downloads."


Let's Write Some Code!

First off, what does Microsoft have to say about actions embedded in notifications?

This method provides a way for you to create interactive notifications. By default, users have the option to dismiss the notifications. However, there might be cases where you want to provide users with different actions that they can take to address the notification, like opening an associated page for modifying data.

Notifications - Business Central | Microsoft Learn

Steps:

  • Create a Report to display Items with Zero Inventory.

  • Create a Codeunit to call your report object and run it without a request page.

  • Expand notification logic on your Item List extension to include action call:

Blue Arrow: Points to the part of the "Addaction" method where the name of the action in the front-end will be set.

Yellow Arrow: Points to the part of the "Addaction" method where the codeunit to run can be specified.

Green Arrow: Points to the part of the "Addaction" method where the particular function in the earlier set codeunit can be specified.


Testing Our Code...


When we click on "Print Report", our report is automatically generated:


This brings us to the end of our topic on Notifications in Business Central. Hope you learnt a few new tricks!

Download code from my GitHub: https://github.com/FolaCodedd/Notifications_Business-Central.git

More Sources:

Notifications - Business Central | Microsoft Learn

Microsoft Dynamics 365 Business Central: Adding New Notifications | Dynamics 365 Lab

Cheers, Fola

Yetunde Adeleye

Senior ERP Consultant

1 个月

Very nice to have functionality. Well-done Fola. This kind of report will solve the problem of the inventory manager having to make inventory restock plans multiple times.

要查看或添加评论,请登录

Folayinka Olaofe的更多文章

社区洞察

其他会员也浏览了