OnInsert trigger does not fire

If Inserts are done in code using locking.E.g. this issue regards Reservation Entry inserts ,If I created trigger OnInsert it never fires until I insert the record manually.

This correct.

The problem is that the insert commands for the reservation entries are not called with the optional bool parameter (TRUE).

So if you need to trigger the code, you would need to replace all “INSERT” commands with “INSERT(TRUE)”.

To find out where receords are being inserted you could use the Navision Development toolkit.

The real problem is that there is now INSERT commands in the code (I am talking about NAV native code which inserts in the Reservation table).They just use UPDATEFORM command instead of insert ,and there is no such parameter in that command .

Hello ‘a’ from ‘asdasd’, I think there’s some misunderstanding about what it is exactly what you need. Inserts are not done simply by locking, and when records are inserted through form updates, the OnInsert trigger in the table does fire. If you tell us exactly what object you are looking at, and what you want to change about it, maybe we will understand what you need and help you from there.

Maybe you just try a “CurrForm.SAVERECORD” insted of (or better before) the “CurrForm.Update” command - if that is what you are talking about.

First sorry for not setting my profile info.My name is Alex.I am novice to NAV and C\AL.I was developing in C# and MS SQL before.So some behavior is string for me.My task seems to be quite simple ,but hard to realize in NAV.So there is a table 337 “Reservation Entry”.Insertions in that table are doing in many forms and many procedures ,but I want to fill my custom table with data on insertion i that table .I have either to put my custom code in many places ,or write one single trigger for all possible insertions.Thats why I want that trigger.

Hey Alex, welcome to DUG, and I hope you are liking your new task working with NAV.

Your first mod and right away working in the Reservation Entry table… I would have assigned this task to one of my most experienced people, because that area is very tricky. There is a LOT of code to dig through when they are created in the reservation system, and then there’s this very complicated way of putting stuff on that form, with temporary variables, and nested steps… I can feel your pain, I would not want to do this myself…

As long as you know what to do and what to check, you can write directly into the table, provided that you validate the right values. BUT you must know what you’re doing, so have an experienced consultant show you exactly which type of reservation is needed, and take it from there. Have them show you exactly how it is done manually, so that you can figure out what happens behind the scenes using the debugger, and then you can mimic that process in the code.