Detect record insert without going through OnInsert trigger
jmlozares
Member Posts: 110
Hi!
Is there a way to detect record activities such as insert, modify, or delete withouth using the standard triggers from table or form?
Thanks and Best Regards to all!
Is there a way to detect record activities such as insert, modify, or delete withouth using the standard triggers from table or form?
Thanks and Best Regards to all!
Janderol Lozares Jr.
Manila, Phils.
Manila, Phils.
0
Comments
-
-
But we're only using the native option.
Could you suggest any better idea about this thing im currently in right now?
Im doing this application that would detect all records' activities, particularly the inserting, modifying and so on.. Using the standard OnInsert, OnModify,..., I could have accomplished this, but the problem is that I there are thousands of routines that could possibly programmatically inserts, modifies,... record withouth calling the triggers for the respective actions, i mean the OnInsert(TRUE), OnModify(TRUE) stuff... with this scenario, there's no way fro me to detect if changes have been made with the record..
I would appreaciate a lot if you could suggest some..
Thanks!
Janderol Lozares Jr.
Manila, Phils.0 -
Maybe you could use the change log functionality of the standard Nav to detect the changes...
I think this is your only way...0 -
I did try activating such feature but also it doesn't work for programmatic updating of record that doesn't trigger the OnInsert, OnModify,... triggers..
hmmm... seems there's no way out from this.. Try to find some other way for this...
Anyway, thanks for your time!
Janderol Lozares Jr.
Manila, Phils.0 -
you could have a separate table as reference an compare the difference and do what you need to do.0
-
hi!
For now I don't have the concrete idea about the one you suggested but you seem to have a good point... And that seems to be my last resort..
I'll give you feedback as soon as im able to make this one.. great!
Thanks!Janderol Lozares Jr.
Manila, Phils.0 -
Sorry I responded from a friends cell phone. Cool toy.

Basically you need a separate table that will be a copy of the original. Everytime you do the comparison, you will write the different to what ever you need to do and then sync records in the tables.0 -
There AREN'T thousands of routines that can insert data. Every Item Ledger Entry / Value Entry gets inserted from CU22. Every G/L, Vend, Cust, VAT etc. entry gets inserted from CU12. Every postes Sales Document from CU80 etc.
Are you trying to write a change log for integration/synchronization purposes? I've seen a big, professional add-on for that - they created logging function in a CodeUnit and simply called it from each master data record from the triggers, for the entry records from the posting codeunits etc. Check out the RecRef example in the downloads - such a logging function should receive as a parameter something like a table no., primary key fields text array(10) for example, xRec and Rec and compare it through FieldRefs I think.
Simply decide what tables you will actually need - I'm sure it's not every table. This is exactly the case when a general solution is not possible, but a custom solution is not too hard.
For example, if you want to synchronize inventory transactions from a store to a headoffice, you only need to call it from CU22, and if you want to synchronize Item master data from the headoffice to the store, you only need to call it from the 6-8 master data table triggers relating to Items.0 -
Hi!
I think you are pertaining to LSR's Replication. We are actually using such feature right now and really works fine.
What im trying to do right now is to have something like a syncronization application that would detect every record activities such as inserting and modifying of record, without worrying from what specific routine the updating is taking place. Using the standard triggers (OnInsert, OnModify, etc..) I could have achieve this, but my concern is what about those routines that programmatically updates record without calling these standard triggers, what I mean is routine like Item.INSERT, Item.MODIFY, etc..
With LSR's Replication, is assumes that every updating of record passes through the standard triggers...
I hope you get my point.
Best Regards!Janderol Lozares Jr.
Manila, Phils.0 -
Hi Arar3n!
Does it mean I have to read the content of the entire table (Main table) everytime the user opens the database and go through all the records? With table like UOM this could work fine, but how about for Item, Item Variant, Barcodes, etc.. ?
Best Regards!Janderol Lozares Jr.
Manila, Phils.0 -
I was wrong, I checked out with Developer's Toolkit, and sadly the posting Codeunits are not the single point of entry in reality. What I did is I looked for G/L Entry table in Developer's Toolkit, click Where-Used With and written INSERT into Object Command Filter. And sadly I found out that f.e. Report Adjust Add. Reporting Currency also inserts G/L Entries, bypassing the posting CodeUnit - quite a bad idea, actually

I can suggest two things. First, find out what tables you need and check them out with Developer's Toolkit and manually insert the logging function call everywhere.
Second, upgrade to SQL and try to create some general, global trigger - I've heard it's possible but I'm not sure how.0 -
Hi!
yeah you're right.
I have thought of doing the same but as I was checking the routines from the DevToolkit, I was really overwhelmed of the routines doing all the updating. I don't think I would take the first option. Moreover, many developers touches the program, they might miss out putting the logging function.
With the second option, I'm also taking this thing to consideration, but I don't think some clients would do this major shift just for the sake of this synchronization stuff i'm having on my mind.
I've tried tracing through the ApplicationsManagement Codeunit 1 hoping Navision passes through this particular codeunit everytime there's a record activity irregardless if the OnModify, OnInsert, etc.,.. trigger is called or not. I found out that Navision actually goes through this codeunit but only if the standard triggers is called. Too bad.
Still Im hoping to find some other ways to really make this thing work. whew! this seems to be a tough job. I'll get you updated if i would find other way to solve this one out. Thanks!Janderol Lozares Jr.
Manila, Phils.0 -
jmlozares wrote:Hi Arar3n!
Does it mean I have to read the content of the entire table (Main table) everytime the user opens the database and go through all the records? With table like UOM this could work fine, but how about for Item, Item Variant, Barcodes, etc.. ?
Best Regards!
Yes You would need to loop through the records. You wouldn't need to do this when the user logins, but have as a Job in LS retail scheduler. Create a codeunit or report to do it.0 -
:-k let me just think about this first.
Best Regars!Janderol Lozares Jr.
Manila, Phils.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 327 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

