AXForum  
Вернуться   AXForum > Microsoft Dynamics NAV > NAV: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 17.11.2020, 13:11   #1  
Blog bot is offline
Blog bot
Участник
 
23,562 / 800 (74) +++++++
Регистрация: 28.10.2006
vanvugt: How-to: Add your notification to My Notifications
Источник: https://dynamicsuser.net/nav/b/vanvu...-notifications
==============

In my post How-to: Create Notifications – Steps to Take I introduced a step-by-step recipe that can help you to efficiently create a (non-intrusive) notification. I gladly used the YouTube video Develop SAAS user experiences for Dynamics 365 Business Central by Daniel Rimmelzwaan to illustrate this. Doing this I stuck to his example without adding anything, but the step-by-step approach.

In this post I would like to extend the example allowing you to add your notification to My Notifications and enabling the user to turn on or off your notification. To achieve this I need to do three additional steps, continuing the numbering of the steps as introduced in How-to: Create Notifications – Steps to Take.
  1. Add notification to My Notifications
  2. Create IsEnabled check method
  3. Call IsEnabled in send-or-recall method
6. Add notification to My Notifications

A notification is being added to My Notifications based on the discovery design pattern. This can easily be achieved with a subscriber to the OnInitializingNotificationWithDefaultState publisher on the My Notifications page.

[EventSubscriber(ObjectType::Page, Page::"My Notifications", 'OnInitializingNotificationWithDefaultState', '', false, false)]
localprocedure OnInitializingNotificationWithDefaultState()
var
MyNotifications: Record "My Notifications";
begin
MyNotifications.InsertDefaultWithTableNum(NotificationIdLbl,
CompanyInfoMissingNotificationMsg,
CompanyInfoNotificationDescriptionTxt,
Database::"Company Information");
end;
Note that we reuse the NotificationIdLbl and CompanyInfoMissingNotificationMsg labels already created as part of the previous steps and that an additional label is needed.

var
CompanyInfoNotificationDescriptionTxt: Label'Show warning when the company information is not complete.';
7. Create IsEnabled check method

We need a method that determine whether the notification is enabled or not (by the user).

localprocedure IsCompanyInfoNotificationEnabled(CompanyInfo: Record "Company Information"): Boolean
var
MyNotifications: Record "My Notifications";
begin
exit(MyNotifications.IsEnabledForRecord(NotificationIdLbl, CompanyInfo));
end;
8. Call IsEnabled in send-or-recall method

And finally we need to call the IsEnabled method by adding the following tow lines to the SendOrRecallCompanyInfoMissingNotification methodthat was created in step 4, after the company record was gotten.

ifnot IsCompanyInfoNotificationEnabled(CompanyInfo) then
exit;
Now you have a complete action plan to create a notification and enable the user to configure whether it will appear or not. Have fun.




Источник: https://dynamicsuser.net/nav/b/vanvu...-notifications
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
vanvugt: How-to: Create Notifications – Steps to Take Blog bot NAV: Blogs 0 15.11.2020 15:11
sertandev: How to receive D365FO push notifications using Azure Notification Hubs Blog bot DAX Blogs 0 04.07.2019 18:11
alexef: How to add a field to Item Card in Business Central Blog bot NAV: Blogs 0 22.05.2018 20:11
vanvugt: How-to: Add Visual Studio Command Prompt To Visual Studio Blog bot NAV: Blogs 0 13.03.2017 11:11
atinkerersnotebook: Walkthrough & Tutorial Summary Blog bot DAX Blogs 1 09.09.2013 09:11
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 03:51.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.