trigger in a table

nunzios
Member Posts: 4
in OnInsert trigger of a table I Have inserted some code. The trigger is not always executed. Why it is not always executed every time I insert a new record?
Thanks.
Thanks.
0
Comments
-
Put <record>.insert(TRUE) if u want the Oninsert trigger to run..0
-
That is not only so for the OnInsert trigger, the same thing is it at the OnModify (<record>.modify(TRUE)) or the delete and the rename.0
-
That is not only so for the OnInsert trigger, the same thing is it at the OnModify (<record>.modify(TRUE)) or the delete and the rename.0
-
Thanks for the answare, but unfortunatelly it is not the solution for my problem
What I would like to do is to replicate a table (i.e. "Item Ledger Entry") in a new table
to do so I inserted under the "OnIsert"/OnModify/OnDelete section of the original table some code
the problem is that it doesn't execute the trigger when I insert/Modify/delete for example trought a "post"0 -
if you want to replicate a table why dont u use the transferfields command?
what do you mean with POST???0 -
What nunzios means, when someone posts a transactions with Items, he would like to copy ILE to second table. (Posting of purchase/sales orders/ Item Journals, etc.)
nunzios, check CU22 function InsertItemLedgEntry, where ILE are being inserted. Fix the line at the near end of function fromItemLedgEntry.INSERT;
toItemLedgEntry.INSERT(TRUE);
®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
ahh ok,
if you want to have alway´s the same data in the 2 tables the best thing
would be:
OnInsert()
Table2.transferfields(rec);
Table2.insert;
OnModify()
Table2.Transferfields(rec);
Table2.modify;
.. and so on
Table2 is your destination table for the update;0 -
To be more error free use:
OnInsert()
Table2.transferfields(rec);
If not Table2.insert then Table2.modify;
OnModify()
Table2.Transferfields(rec);
If not Table2.insert then Table2.modify;
but still this is not enought. If you really want your table2 to be allways updated, you must ensure that all calls in every code will trgger OnInsert and OnModify - that means INSERT must be called with TRUE parm and MODIFY the same. If you omit parm, it is FALSE by default.®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
Thanks Arun/Warfox/RobertMo
I have sorted out my problem and our code looks much better and is more efficient
We are managing a intercompany logistics problem
If you are interested in the explanation of the entire architecture I would be happy to discuss it with you0
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