Dynamics NAV 2017 - Notifications on Open Page / Next Record

robbonick
Member Posts: 40
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"
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:
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.
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.
0
Best Answer
-
For those interested I amended the code to look like this, which solved the issue.
IF ("Assigned User ID" <> USERID) THEN IF NOT AssignedUserNotificationSent OR ((Rec."No." <> xRec."No.") AND (xRec."No." <> '')) THEN BEGIN AssignedUserNotification.MESSAGE := NotAssignedUserNot; AssignedUserNotification.SCOPE := NOTIFICATIONSCOPE::LocalScope; AssignedUserNotification.SEND; AssignedUserNotificationSent := TRUE; END;
0
Answers
-
For those interested I amended the code to look like this, which solved the issue.
IF ("Assigned User ID" <> USERID) THEN IF NOT AssignedUserNotificationSent OR ((Rec."No." <> xRec."No.") AND (xRec."No." <> '')) THEN BEGIN AssignedUserNotification.MESSAGE := NotAssignedUserNot; AssignedUserNotification.SCOPE := NOTIFICATIONSCOPE::LocalScope; AssignedUserNotification.SEND; AssignedUserNotificationSent := TRUE; END;
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions