Logging User Activity

Jonathan2708Jonathan2708 Member Posts: 552
Hi,

Due to a potential security breach, I have been tasked with monitoring the customer records that users are accessing in Navision. I started by creating a table to store the user id, date/time, customer no. etc. Then I added code to the OnAfterGetRecord / OnAfterGetCurrRecord triggers on the customer form to insert a record to log the event, only to find that these 2 triggers do not permit any writing to the database.

Can anybody suggest an alternative method to achieve this? It's Navision 3.7 running against SQL 2000. I've looked at monitoring the SQL server but this doesn't appear useful as the statements are all wrapped in RPC calls.

Any help appreciated,

Jonathan

Comments

  • krikikriki Member, Moderator Posts: 9,118
    There is a granule to use standard logging. The form is General ledger=>Setup=>Change log setup.
    If you don't have it, you can put some code in the OnInsert,OnModify,OnDelete,OnRename-triggers of the table. And use rec and xRec to confront the changes in the records.
    Remember that these triggers will only be fired if changes happen in the form or in code with e.g. INSERT(TRUE).
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Jonathan2708Jonathan2708 Member Posts: 552
    Hi,

    Thanks for the reply. However I'm mainly interested in which records the users have visited, not necessarily changed.

    Jonathan
  • krikikriki Member, Moderator Posts: 9,118
    Some idea:
    Create a singleinstance codeunit with a temptable in it and a function that gives you the table id and primary key of the table. The function saves it in the temptable of the singleinstance codeunit. Don't save it in the real table because this function must be called from the OnAfterGetCurrentRecord-trigger of the different forms and saving to the table is not allowed.
    Put automation "'Navision Timer 1.0'.Timer" (with property WithEvents) in that codeunit and enable it when the function is called the first time.
    In the "autTimer::Timer(Milliseconds : Integer)" of the codeunit, check the temptable and if there are records, save them in the real DB and delete them from the temptable.
    I didn't test if it works, but I think it can work, because you save the records when OUTSIDE ANY OF THE TRIGGERS in the form(s).
    Remember also that you will have LOTS of records in that table.
    So you also need a table with a biginteger as primary key and property AutoIncrement=yes. So you don't need to increment the field yourself.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.