This relatively small amount of code will create an effective audit trail that can be as simple or as comprehensive
as you want.
The result is a trail that records each event on a separate line (Person/Date/Activity) showing the latest at the top. Recorded events can be any type of activity within the form from field value changes to action buttons. I have found it particularly effective where authorization routes are required such as when several people will be making changes to the same document.
This routine can be added to many areas within the form. I currently have it on exiting some crucial fields as well as approval routing buttons.
The trail is made up of three computed fields that are set in a three-column/one row table. Each field is text format and allows multiple values with the display viewed on separate lines. Their own field name is entered in the computed value section.
Note: For the field values to line up, you need to ensure that the action descriptions appear on one line only such as not too long which can be resolved with additional coding.
The fields are...
AuditName AuditDate AuditDetails
The code can be added to your script action buttons or on exiting/entering a field. You need to ensure that the document is in Edit Mode to make a change.
The code is as follows and works very effectively. All you do is hardcode the message for the current activity. I also on occasions pick up field values using uidoc.fieldgettext("") and add them to the message.
Dim s As New notessession Dim uiw As New notesuiworkspace Dim uidoc As notesuidocument Set uidoc=uiw.currentdocument 'Check uidoc is in edit mode uidoc.editmode=True 'Ammend Audit Trail AuditName=uidoc.fieldgettext("AuditName") AuditDate=uidoc.fieldgettext("AuditDate") AuditDetails=uidoc.fieldgettext("AuditDetails") AuditName=s.commonusername+Chr(10)+AuditName AuditDate="["+Str(Now)+"]"+Chr(10)+AuditDate AuditDetails="Enter your specific message here ..."+Chr(10)+AuditDetails uidoc.fieldsettext "AuditName",AuditName uidoc.fieldsettext "AuditDate",AuditDate uidoc.fieldsettext "AuditDetails",AuditDetails