SnTT.jpgSome of my customers want to keep track of changes to particular fields. I while back I built a script library, which can be used in any database and form.
Below is a simplified version, to get you started.
Here's what to do in the form:

  • Add a field to a form called 'TrackingFields'. Make it multi-value and computed for display, and add the names of the fields to track to it, e.g. "LastName":"Title". You could also fetch this info from a database profile, the database responsible user can update him/herself !
  • Put in the form's Global Options: Use "ChangeTracking"
  • Put in the PostOpen event: TrackingInit source.Document
  • Put in the QuerySave event: TrackingVerify source.Document

Here's the code for the 'ChangeTracking' Script Library:

This is what happens:
As soon as the user opens a document, the values of the 'fields to be tracked' are stored in a global list variable 'TrackingCurrent'
  • When the user saves the document, the values are compares with the values initially stored
  • If there are changes to those fields, they are stored (in this case in the document itself)
  • There's a small 'Assemble' function to handle both single and multi-value fields
How do I usually implement this? Well, I save the changes in separate documents (sometimes in a separate 'tracking database'), including the UNID and some extra info regarding the original document (user-definable, similar to the 'TrackingFields' field, but a 'TrackingInfo' field).
Comments and improvements: please !
I've added a more complete code,
with the optional 'TrackingVerifyDB' sub too:
ChangeTracking.lss

Category:  Domino/Notes  | TechnoratiTechnorati: ,