1
votes

In some 'old' lotus notes applications, we created a history of each document: who created the doc, every person which edited it + the respective dates. The code contained several libraries in lotusScript.

For xpages, is there any snippet / sample working example which I could use? I found this but I couldn't download any example ...

3

3 Answers

2
votes

ValueChangeListeners allow you to capture changes to specific components. I've used them to create audit trails in customer applications before.

Tony McGuckin has an XSnippet for it: http://openntf.org/XSnippets.nsf/snippet.xsp?id=server-side-value-change-events-listeners

Declan Lynch covered it in a blog post: http://www.qtzar.com/using-a-valuechangelistener-to-build-an-audit-trail/

Don McNally has also done a blog post: http://dmcnally.blogspot.co.uk/2013/02/xpages-detecting-and-logging-field.html

0
votes

I don't know of any pre-done snippet yet. But this becomes a lot easier in XPages especially if expand into Java. When I create an application these days I basically convert the document to a Java object. I don't do this yet but it would be easy to store in the object a Map of all the fields and their current values and then on save, look for differences and then write them out to a log document.

this could be done without java of course. Create an map object in scope. Populate it on loading of the document and on save do the compare and write.

0
votes

Something went wrong with that project on OpenNTF (don't ever use an ampersand in the name). I'm the original author of that custom control. AFter some digging I found a direct url to the project here.