Table OnInsert Trigger

Rikarddo
Member Posts: 80
Hi all,
I'm working on NAV 2016 and i have an external application that send data to a NAV Table through an SQL Update.
Whenever a new record is created I want to send an email to some employees as the code below shows.
However by what I realize the Trigger OnInsert of the table is not activated.
I was searching and read something about Local OnDataBaseInsert in (CU1)
It Calls a CU 5150
So what can i do to the code on my table can be executed? Or i shouldn't change these CU's?
I'm working on NAV 2016 and i have an external application that send data to a NAV Table through an SQL Update.
Whenever a new record is created I want to send an email to some employees as the code below shows.
OnInsert() Recipients:='roliveira@sameca.com';// SMTPMailSetup.GET; SMTPMail.CreateMessage( '', 'roliveira@sameca.com', Recipients, TestMailTitleTxt1, STRSUBSTNO( MailBody, USERID),TRUE); SMTPMail.Send;
However by what I realize the Trigger OnInsert of the table is not activated.
I was searching and read something about Local OnDataBaseInsert in (CU1)
OnDatabaseInsert (RecRef: RecordRef) ChangeLogMgt.LogInsertion (RecRef); IntegrationManagement.OnDatabaseInsert (RecRef); //This one?? OnAfterOnDatabaseInsert (RecRef);
It Calls a CU 5150
IF IsIntegrationRecord (TableID) OR IsIntegrationRecordChild (TableID) THEN BEGIN Insert: = TRUE; Modify: = TRUE; Delete: = TRUE; Rename: = TRUE; END;....
IsIntegrationRecord (TableID: Integer): Boolean EXIT (TableID IN [DATABASE :: Resource, DATABASE :: MYTABLE]); // ??
So what can i do to the code on my table can be executed? Or i shouldn't change these CU's?
0
Best Answer
-
You should do the update through a web service published by the NAV server. These triggers only fire if it's NAV that does the modify.
Or at least create a boolean in the table that tells if notification has been sent or not and create a codeunit that takes care of notification and run that codeunit with the job queue every minute. I guess it doesn't have to be a real-time notification.Lars Westman
http://www.linkedin.com/in/larswestman5
Answers
-
You should do the update through a web service published by the NAV server. These triggers only fire if it's NAV that does the modify.
Or at least create a boolean in the table that tells if notification has been sent or not and create a codeunit that takes care of notification and run that codeunit with the job queue every minute. I guess it doesn't have to be a real-time notification.Lars Westman
http://www.linkedin.com/in/larswestman5 -
Thanks for the tip, Lars_Westman0
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