Setting up Change Log to track Modification of objects

spycraftspycraft Member Posts: 66
Hi..

I'm currently looking into the Change Log functionality to track the insertion, modification and deletion of Navision objects (Table 2000000001).

Although I have defined to track insert, modify and delete for all fields of Table 2000000001, I noticed change log entries are created only for deletion of Navision objects.

Is this how Change Log works or have I missed any other configuration, where Change Log did not log any entry?

Regards,
Spy

Comments

  • kinekine Member Posts: 12,562
    Only user changes are logged in Change log. For example if you do MODIFYALL in code on some field, no log is created. Change log have limited functionality. It is only for tracking User changes, not changes from code.

    Save of object is in this case made through code, not by user, there may be the problem.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • MrDeeMrDee Member Posts: 48
    If you are sitting on a SQL database you could write a SQL triggger to catch ALL changes (user or code created)

    you could base it on this (a trigger for the objects table)
    http://www.mibuso.com/dlinfo.asp?FileID=351
  • spycraftspycraft Member Posts: 66
    kine wrote:
    Only user changes are logged in Change log. For example if you do MODIFYALL in code on some field, no log is created. Change log have limited functionality. It is only for tracking User changes, not changes from code.

    Save of object is in this case made through code, not by user, there may be the problem.

    Hi Kine,

    Thanks for your response.

    Just a further thought: since saving objects are made through code, how do we explain the logging of deletion of Navision objects?
  • spycraftspycraft Member Posts: 66
    MrDee wrote:
    If you are sitting on a SQL database you could write a SQL triggger to catch ALL changes (user or code created)

    you could base it on this (a trigger for the objects table)
    http://www.mibuso.com/dlinfo.asp?FileID=351

    Hi MrDee,

    Thanks for your recommendation. It fits exactly my objectives perfectly!
  • MrDeeMrDee Member Posts: 48
    :D
  • kinekine Member Posts: 12,562
    spycraft wrote:
    Hi Kine,

    Thanks for your response.

    Just a further thought: since saving objects are made through code, how do we explain the logging of deletion of Navision objects?

    How do you delete objects? You press F4 - it is user delete action.
    How do you save or create new objects? By wizard or with some CTRL-S or something which will ask you Do you want to save..... compile.... it is some code which save objects.

    This is main difference... ;-)

    Yes, SQL trigger is solution...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • mestremestre Member Posts: 24
    Hi,

    I'm trying to use your script, but in some databases I'm getting the message bellow in NAV.

    After I run the script against database and then, try to save, create, delete a object in NAV I get the error and I could not create, delete or modify any ibjecto inside NAV.

    Any idea about it?

    Thanks,
    Nuno

    Microsoft Business Solutions-Navision
    Aconteceu o seguinte erro no SQL Server em tanto ao acessar à Object tabela:

    8152,"22001",[Microsoft][ODBC SQL Server Driver][SQL Server]String or binary
    data would be truncated.
    3621,"01000",[Microsoft][ODBC SQL Server Driver][SQL Server]The statement
    has been terminated.

    SQL:
    UPDATE "TESTDB"."dbo"."Object" WITH (REPEATABLEREAD) SET "BLOB Reference"=
    NULL,"BLOB Size"=4404,"Date"={ts '2008-12-12 00:00:00.000'},"Time"={ts
    '1754-01-01 18:43:22.941'} WHERE ("Type"=5 AND "Company Name"='' AND
    "ID"=85002) AND ("timestamp"<=0x0000000034E9CBE8)

    OK
    Cumps,
    Mestre
  • prasad4spprasad4sp Member Posts: 4
    mestre wrote: »
    Hi,

    I'm trying to use your script, but in some databases I'm getting the message bellow in NAV.

    After I run the script against database and then, try to save, create, delete a object in NAV I get the error and I could not create, delete or modify any ibjecto inside NAV.

    Any idea about it?

    Thanks,
    Nuno

    Microsoft Business Solutions-Navision
    Aconteceu o seguinte erro no SQL Server em tanto ao acessar à Object tabela:

    8152,"22001",[Microsoft][ODBC SQL Server Driver][SQL Server]String or binary
    data would be truncated.
    3621,"01000",[Microsoft][ODBC SQL Server Driver][SQL Server]The statement
    has been terminated.

    SQL:
    UPDATE "TESTDB"."dbo"."Object" WITH (REPEATABLEREAD) SET "BLOB Reference"=
    NULL,"BLOB Size"=4404,"Date"={ts '2008-12-12 00:00:00.000'},"Time"={ts
    '1754-01-01 18:43:22.941'} WHERE ("Type"=5 AND "Company Name"='' AND
    "ID"=85002) AND ("timestamp"<=0x0000000034E9CBE8)

    OK


    I also faced this issue, and realized that My database name was having length of 23 characters and in NavAudit query it is mentioned just Varchar 10. After increasing database Name field length this issue got resolved. You can check for your fields, if somewhere you can increase length of your string for that query to work.
Sign In or Register to comment.