Search code examples
lotus-noteslotus-dominolotusscript

Adding logging in Lotus Notes form


I want to add logging capabilities in my Lotus Notes application. Basically I want to be able to log who make the change, when the change is made, and what field(s) is/are changed in a document. What is the best way to do this? I am thinking to also add this at the end of each document so the user knows who make the changes.


Solution

  • I've done this before using LotusScript. It's a bit of a pain, but the basic idea is to:

    • Create an array or new document object within the QueryOpen event, and store the values for all the items in the current document.
    • In your QuerySave event, compare the values of the current document to the in-memory copy you made, and then log any differences.

    You can create a field on the form to write these changes to, and just append to it each time.

    Watch out for other event handlers that make changes everytime the document opens, though. You may need to copy original values in the PostOpen event, for example, if you change some fields in the QueryOpen event each time the doc opens, otherwise you'd get false change logs.

    Hope this helps!