Hi,
I am currently struggling with an issue regarding Notifications in Dynamics NAV 2017. I have a table with a field "Assigned User ID".
When a user opens a page, I would like to send a notification if they are not the "Assigned User"
(USERID <> "Assigned User ID")
I am using the trigger "OnAfterGetCurrRecord" to send the Notification if it is required.
The issue is, that when the page is opened the notification is sent multiple times as this trigger is called multiple times.
So initially I added a Boolean, which is set to true when the notification is sent.
So the logic looks like this:
IF (Assigned User ID <> USERID) AND NOT NotificationSent THEN BEGIN
SendNotification();
NotificationSent := TRUE;
END
This works, and stops the notification being sent multiple times.
The next issue is, that the users I am working with use the "Next" and "Previous" Actions to navigate through records.
With my current logic, this means that the notification is not sent when the next record is opened, as the Boolean I set is still equal to TRUE.
I have tried to add some code on the trigger OnNextRecord to set the Boolean to false, but this causes those Next/Previous actions to stop working.
Has anyone encountered this before, or does anyone have a solution for this?
Thanks in advance.
Nick.
Answers