1

A business owner of my ticket tracking app in Xpages wants to track every change to the document. If a user opens the doc in edit mode but doesn't change anything, then no tracking. If, however, they open up a document and change one field, I have to capture that.

Here is my solution. When a user edits a doc, I create a "shadow document", which is a "before" vision. When the user saves I am comparing field for field for changes, and then acting appropriately.

Is there a better way to do this?

Bryan Schmiedeler
  • 2,977
  • 6
  • 35
  • 74
  • A couple unique times I had a use case (with a relatively small amount of fields) where I've copied the pre-edit values into a _viewScope_'d _HashMap_ when the user triggers "edit" mode, then immediately prior to my save event, I do a comparison of current to previous values. This means I can observe exactly what has changed (and when and by whom), where you store that could be anywhere. – Eric McCormick Nov 04 '15 at 17:38
  • I have been trying to implement this and have really been struggling. If you find an easy way to implement please let me know. – Patrick Sawyer Nov 11 '15 at 23:31

2 Answers2

1

This is another good use case for Java beans. If you create a bean which sits between XPages-UI and Domino back-end document then you can easily track field changes.

Karsten Lehmann wrote a blog about it some time ago.

Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
1

... and you could use the OpenNTF Domino API that has functions for exactly this. As far as I remember there is an example of this in the demo database. Not sure if it is also in the new version of the demo database - but then you may just need to find an older version (e.g. for milestone 4.5 where I saw this).

/John

John Dalsgaard
  • 2,797
  • 1
  • 14
  • 26