OnGlobalInsert in CU 1 doesn't work for object table

LyuchinLyuchin Member Posts: 23
Hi nav community!

I need to track all changes within Nav objects. So I activated change log via Change Log Setup form for Object table and set Log Insertion, Log Modification and Log Deletion to All Fields. Then changed CU 1 adding MESSAGE in all OnGlobalXxx methods to test what will happen. Next I tried to test it. I created a new table, I expected message "Insert" b/c trigger OnGlobalInsert had to be caused. But nothing happend. After I tested all other actions (like renaming or deletion this table) and they work!
So my question is: why OnGlobalInsert trigger is not caused in the case of Object table, while it's working fine for all others tables provided that the change log is activated for these tables? And how to make to work it?

Thanks in advance! Will wait for your help.

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    It's probably because you are not modifying the Object table directly. It is done by NAV, when you create or modify a table.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • LyuchinLyuchin Member Posts: 23
    Implicitly, right. But why then delete, modify and rename work?
  • kinekine Member Posts: 12,562
    If you try to insert the object by F3, it will work. But because you are using Wizard to create it, it will not work... this is my view on this...

    Have you tried the rename/modify from within the designer itself or just by changing the field values in the object list?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • LyuchinLyuchin Member Posts: 23
    kine wrote:
    If you try to insert the object by F3, it will work. But because you are using Wizard to create it, it will not work... this is my view on this...

    Have you tried the rename/modify from within the designer itself or just by changing the field values in the object list?

    No no, I don't use any wizards. To test functionality I''m just trying to create any object, let's say Table, in the object designer by clicking on New button. After structure definition is done and object is saved, OnGlobalInsert have to be triggered (because a new record was inserted into Object table), but actually it has not.
  • kinekine Member Posts: 12,562
    But still, I am not sure if it will help you, because you can edit the objects even when you have no company selected, but Change log is set per company... :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ara3nara3n Member Posts: 9,256
    there are tools in download folder that allows you track changes using sql triggers.

    If you are on sql 2008, you can use sql tools to track changes on object table.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • LyuchinLyuchin Member Posts: 23
    Ok, I found workaround without using of navision. It is not actual now. Thanks all who replied.

    Now I have another complex question: how to catch import of objects (File > Import...) in Navision. There is no correspond method to track import in CU 1. In other words I need certain track that import is done.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Lyuchin wrote:
    There is no correspond method to track import in CU 1. In other words I need certain track that import is done.
    Don't think you can track down if a fob was imported.

    You could create a dummy object (for example codeunit 90001) which you include with the other objects in the fob-file. Then you can check if this dummy object exists in the database, to know if the fob has been imported.
    The 2nd fob will have codeunit 90002 as dummy object, which you can check to know if fob 2 has been imported. Etc.

    I know this is not foolproof however.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • kinekine Member Posts: 12,562
    Best is to use trigger on Object table on SQL. On Native you do not have this possibility...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rdebathrdebath Member Posts: 383
    Lyuchin wrote:
    Now I have another complex question: how to catch import of objects (File > Import...) in Navision. There is no correspond method to track import in CU 1. In other words I need certain track that import is done.

    If you're tracking from an SQL insert trigger all the objects in the import will be put into the database in the same transaction. If there's only one object you're kinda stuck, though you can catch some of them because the BLOB will be updated and the modified flag will be false. Maybe the modified time?

    Just to be certain, there is NO way to make sure you can log everything from C/SIDE because changes to the object table can be made when you're not in a company and nothing will be called.

    You can track every change from SQL but it's not always easy to interpret what triggered the change.
    viewtopic.php?f=23&t=33344#p162604
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Lyuchin wrote:
    Ok, I found workaround without using of navision. It is not actual now. Thanks all who replied.

    What was the work around?
    David Singleton
  • LyuchinLyuchin Member Posts: 23
    Lyuchin wrote:
    Ok, I found workaround without using of navision. It is not actual now. Thanks all who replied.

    What was the work around?

    Well, actually it is even not workarond but the solution with help another programming language, namely C#. Since it will be a tool with source control functionality, we use "bridge" written on C#, so that I used more wide possibilities of .net to solve this problem :)

    About import, yes I agree that the only one possibility to track it is create trigger for Object table.
    Thanks all again!
Sign In or Register to comment.