
OpenNTF Code Bin
About This Code
Brief Description:
Change tracking / audit trail framework . . .
Contributor:
Dallas Gimpel
Category:
Lotusscript, XML/XSL
Notes Version:
R6.x, R7.x
Last Modified:
30 Oct 2007
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
Below is a change tracking / audit trail framework I wrote a few years ago (for the Notes client). I know there are others that are very well done, but I thought this might be worth sharing, too.
Features:
- The size limitation of text fields is avoided by spreading the audit trail across multiple fields as necessary.
- Recorded history is easily rendered in a printable dialog.
- Recorded history may be exported directly to MS Word or as "raw" XML.
- Allows "auditable" fields to be defined on a form-by-form basis.
The Change Auditor framework is comprised of the design elements below, all of which may be found in the attached database along with a sample implementation. See the Help|Using document in the attached database for more information.
Script libraries:
(EnhancedItem)
(ErrorHandling)
(LSHashMap)
(UI - Audit Definition)
(UI - Cascading Menu Builder)
(UI - Change Auditor)
Forms:
Subforms:
(Dialog - Repoert History Display)
(Report History)
Agents:
(Add/Edit Audit Definition profile document)
Images:
Action.gif
Edit.gif
Cancel.gif
Save.gif
Usage / Example
Sample implementation in a Notes form:
Sub Onload(Source As Notesuidocument)
On Error Goto errorHandler
Dim docSrc As NotesDocument
If Not(Source.IsNewDoc) Then
If Source.EditMode Then
Set docSrc = Source.Document
'// This is the code required to "audit" (i.e., maintain a history) changes.
If Not(openAuditTrail(docSrc, docSrc.GetItemValue("Form")(0))) Then
Call docSrc.ReplaceItemValue("SaveOptions", "0") '// suppress the save prompt
Call Source.Close(True) '// an error has occurred - disallow document updates
End If
End If
End If
subExit:
errorHandler:
Call processUIError(FORM_NAME)
Call Source.Close(True)
Resume subExit
End Sub
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim docSrc As NotesDocument
'// This code performs an "audit" (i.e., writes a history) of document changes.
If Not(Source.IsNewDoc) Then
Set docSrc = Source.Document
Continue = closeAuditTrail(docSrc, "")
End If
End Sub
Code Attachments
Comments
No documents found