Options

Table OnInsert Trigger

RikarddoRikarddo 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.
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?

Best Answer

Answers

  • Options
    RikarddoRikarddo Member Posts: 80
    Thanks for the tip, Lars_Westman
Sign In or Register to comment.