Options

OnGlobalModify.... - EDIT: Change Log does not work

MiStaMiSta Member Posts: 19
Hello,

if i change a record i.e. in table 36, the OnGlobalModify-Trigger in Codeunit 1 is not
run through. I am not changing the record by code. I am simply modifying a field in form 42.

Is this a bug in version 6.00.30232 or am I doing something wrong?

Thank you very much in advance

MiSta

Answers

  • Options
    KYDutchieKYDutchie Member Posts: 345
    Hi,

    the OnglobalModify will only run if you allow it to run in the"GetGlobalTriggerMask".
    You will have to modify the code in that trigger if you don't have the Change Log turned on for your table.

    You will have to provide the exit code for that trigger that will determine what triggers will be executed.
    Where the exit code equals:
    1 for Insert
    2 for Modify
    4 for Delete
    8 for Rename.

    So if you want to execute every global trigger except the GlobalDelete Trigger the exit code should be 11 (Insert + Modify + Rename = 1 + 2 + 8. )

    Be very very very very careful that you do not break the Change Log Managment with your changes or cause other serious issues.

    Hope this helps,

    Regards,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • Options
    matttraxmatttrax Member Posts: 2,309
    KYDutchie wrote:
    the OnglobalModify will only run if you allow it to run in the"GetGlobalTriggerMask".

    Did you mean GetTableTriggerMask? The function in Codeunit 423, Change Log Management?

    This is a great post, very interesting.
  • Options
    MiStaMiSta Member Posts: 19
    Thanks.

    Actually my problem is, that the Change Log does not work. The setup is correct:
    - Change Log Setup: Change Log Activated
    - Change Log Setup (Table): Table 36/All Fields/All Fields/All Fields

    Any change in table 36 is not logged.
    The same, if try table 37 etc.

    The changes I made in table 403 (Change Log Setup (Table)) are logged, however.

    Anybody any Ideas?

    Thanks again in advance.
  • Options
    KYDutchieKYDutchie Member Posts: 345
    Hi Mattrax,

    The GetTableTriggerMask in CU423 checks the tableID in the "GetGlobalTableTriggerMask" against the Change log setup table.

    But if you only want to track one table, without turning on the Change log, you can build the following construction in your "GetGlobalTableTriggerMask".
    Declare 2 local integer variables called "MyTableMask" and "ChangeLogMask"
    Clear(MyTableMask)
    IF TableID = Database::"Sales Header" THEN
      MyTableMask := 11; //Checking Insert, Modify and Rename
    
    ChangeLogMask := ChangeLogMgt.GetTableTriggerMask(TableID);
    
    IF MyTableMask > ChangeLogMask THEN
      EXIT(MyTableMask)  //Will cause the Global Insert, Modify and Rename triggers to be executed based on the table action
    ELSE
      EXIT(ChangeLogMask);
    

    But be carefull that you might have to stop processing of the Changelog when you get to the other global table triggers.

    Hopes this helps,

    Regards,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • Options
    KYDutchieKYDutchie Member Posts: 345
    Mista,

    What field are you changing? Fields Like the "Status" field in the sales header table are not tracked by the Change Log.
    This is because the change does not happen in the form but in codeunit 414.

    Regards,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • Options
    MiStaMiSta Member Posts: 19
    Hi Willy,

    does not depend on the field. No field works.
    I.e., I am changing the field "Bill-to Name". Neither code on the form nor on the table, regarding this field.

    I am changing the field on form 42.

    Client is restarted....

    MiSta
  • Options
    KYDutchieKYDutchie Member Posts: 345
    Hi Mista,

    I just tested this on the same version. And mine does track the change to the "Bill-to Name".
    It does show up in the Change log as "Name" since the Caption of the field is "Name".

    Maybe you can run with the debugger and see why it never gets to the GlobalModify trigger.

    Regards,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • Options
    rdebathrdebath Member Posts: 383
    Errm, this may be obvious, but the client does have to be restarted for change log configuration changes to take effect.
  • Options
    jremaudjremaud Member Posts: 4
    Hi,

    I made a test (modify the "Sell-to Customer No." by LookUp) and everything's fine : lot of entries in Change Log...

    Put Breakpoint on OnGlobalModify in Codeunit 1. And see what's happens.
    Dynamics Nav Technical Consultant
    Working with Bug and Debbugger
  • Options
    MiStaMiSta Member Posts: 19
    OK, Thanks to all, did not help though:)

    As mentioned in my original post, the OnGlobalModify Funktion is not ran through.

    I think I have to find another solution.
  • Options
    KYDutchieKYDutchie Member Posts: 345
    Mista,

    Put a breakpoint in this trigger: "GetGlobalTableTriggerMask" in codeunit 1.
    What I would do is put a dummy statement into that trigger. Just create a local variable called "A" and add a line prior to the exit statement like "A:=A".
    Put the breakpoint on that dummy statement.
    It has to come to that trigger and check the value that is returned from the Change log management codeunit.
    I suspect that that value does not include the modify value.

    Regards,

    Willy

    PS: Remove the local variable and dummy statement when you are done. :oops:
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • Options
    MiStaMiSta Member Posts: 19
    Problem is solved.

    There was a bug in CU423. Somebody deleted an important line:)

    Thanks you very much nonetheless.

    MiSta
  • Options
    nvermanverma Member Posts: 396
    Do you remember what the bug was. I am having the exact same issue. The system is not tracking Sales Invoice Line even though the Change Log is configured to keep track of All Fields for Insert, Modify, and Delete.
Sign In or Register to comment.