Good Day:
I intend to keep the document history / audit trial with the user’s name, date & time the document has been changed and what the fields has been changed.
The code I tapped here is perferctly good but the limitation is I have to specify each of the field names one-by-one.
Any solution would help to make the program intelligent to indentify the data has been changed on which field instead of I have to name it one-by-one. Please take note that from time to time, there will be addtional field comes into my form.
Many thanks.
(Declarations)
Dim session As NotesSession
Dim old List As String
PostOpen
Sub Postopen(Source As Notesuidocument)
Set session = New NotesSession
old(“ABC”) = Source.FieldGetText(“ABC”)
old(“XYZ”) = Source.FieldGetText(“XYZ”)
End Sub
QuerySave
Sub Querysave(Source As Notesuidocument, Continue As Variant)
On Error Goto E
Source.Refresh
On Error Goto 0
initial = Source.IsNewDoc
If initial Then m$ = session.CommonUserName & " - " & Cstr(Now()) & " - created document"
Forall F In old
v$ = Source.FieldGetText(Listtag(F))
If Not initial And Not v$ = F Then
If m$ = “” Then
m$ = session.CommonUserName & " - " & Cstr(Now()) & " - modified "
Else
m$ = m$ & ", "
End If
If F = “” Then F = {“”}
m$ = m$ & Listtag(F) & " from " & F & " to " & v$
End If
F = v$
End Forall
If initial Then
Source.FieldSetText “History”, m$
Elseif Not m$ = “” Then
Source.FieldAppendText “History”, Chr$(10) & m$
End If
X: Exit Sub
E: Continue = False
Resume X
End Sub
Apart from the above, hope the reply can come with sorting the history in decending order - latest on the top.
Many thanks!